Current Path : /usr/OAuth-Lite-1.32/blib/man3/ |
|
Current File : //usr/OAuth-Lite-1.32/blib/man3/OAuth::Lite::SignatureMethod::RSA_SHA1.3pm |
.\" Automatically generated by Pod::Man 2.22 (Pod::Simple 3.13)
.\"
.\" Standard preamble:
.\" ========================================================================
.de Sp \" Vertical space (when we can't use .PP)
.if t .sp .5v
.if n .sp
..
.de Vb \" Begin verbatim text
.ft CW
.nf
.ne \\$1
..
.de Ve \" End verbatim text
.ft R
.fi
..
.\" Set up some character translations and predefined strings. \*(-- will
.\" give an unbreakable dash, \*(PI will give pi, \*(L" will give a left
.\" double quote, and \*(R" will give a right double quote. \*(C+ will
.\" give a nicer C++. Capital omega is used to do unbreakable dashes and
.\" therefore won't be available. \*(C` and \*(C' expand to `' in nroff,
.\" nothing in troff, for use with C<>.
.tr \(*W-
.ds C+ C\v'-.1v'\h'-1p'\s-2+\h'-1p'+\s0\v'.1v'\h'-1p'
.ie n \{\
. ds -- \(*W-
. ds PI pi
. if (\n(.H=4u)&(1m=24u) .ds -- \(*W\h'-12u'\(*W\h'-12u'-\" diablo 10 pitch
. if (\n(.H=4u)&(1m=20u) .ds -- \(*W\h'-12u'\(*W\h'-8u'-\" diablo 12 pitch
. ds L" ""
. ds R" ""
. ds C` ""
. ds C' ""
'br\}
.el\{\
. ds -- \|\(em\|
. ds PI \(*p
. ds L" ``
. ds R" ''
'br\}
.\"
.\" Escape single quotes in literal strings from groff's Unicode transform.
.ie \n(.g .ds Aq \(aq
.el .ds Aq '
.\"
.\" If the F register is turned on, we'll generate index entries on stderr for
.\" titles (.TH), headers (.SH), subsections (.SS), items (.Ip), and index
.\" entries marked with X<> in POD. Of course, you'll have to process the
.\" output yourself in some meaningful fashion.
.ie \nF \{\
. de IX
. tm Index:\\$1\t\\n%\t"\\$2"
..
. nr % 0
. rr F
.\}
.el \{\
. de IX
..
.\}
.\" ========================================================================
.\"
.IX Title "OAuth::Lite::SignatureMethod::RSA_SHA1 3"
.TH OAuth::Lite::SignatureMethod::RSA_SHA1 3 "2014-01-04" "perl v5.10.1" "User Contributed Perl Documentation"
.\" For nroff, turn off justification. Always turn off hyphenation; it makes
.\" way too many mistakes in technical documents.
.if n .ad l
.nh
.SH "NAME"
OAuth::Lite::SignatureMethod::RSA_SHA1 \- RSA_SHA1 signature method class;
.SH "SYNOPSIS"
.IX Header "SYNOPSIS"
.Vb 4
\& # Consumer side
\& my $signer = OAuth::Lite::SignatureMethod::RSA_SHA1\->new(
\& consumer_secret => $rsa_private_key,
\& );
\&
\& my $signature = $signer\->sign($base_string);
\&
\& # Service Provider side
\& my $verifier = OAuth::Lite::SignatureMethod::RSA_SHA1\->new(
\& consumer_secret => $rsa_public_key,
\& );
\& unless ($verifier\->verify($base_string, $signature)) {
\& say "Signature is invalid!";
\& }
.Ve
.SH "DESCRIPTION"
.IX Header "DESCRIPTION"
\&\s-1RSA_SHA1\s0 signature method class.
.SH "PRIVATE KEY AND PUBLIC KEY"
.IX Header "PRIVATE KEY AND PUBLIC KEY"
\&\s-1RSA\s0 needs two keys that called public key and private key.
If you runs OAuth consumer application and want to use this \s-1RSA_SHA1\s0 method
for signature on OAuth protocol, you have to prepare these keys.
.PP
To generate them in Perl, here is an example.
.PP
.Vb 3
\& my $rsa = Crypt::OpenSSL::RSA\->generate_key(1024);
\& my $public_key = $rsa\->get_public_key_string();
\& my $private_key = $rsa\->get_private_key_string();
.Ve
.PP
And prior to use OAuth protocol with a service provider,
you have to register public key onto the service provider.
.SH "METHODS"
.IX Header "METHODS"
.SS "method_name"
.IX Subsection "method_name"
Class method. Returns this method's name.
.PP
.Vb 2
\& say OAuth::Lite::SignatureMethod::RSA_SHA1\->method_name;
\& # RSA_SHA1
.Ve
.SS "build_body_hash"
.IX Subsection "build_body_hash"
.Vb 1
\& say OAuth::Lite::SignatureMethod::RSA_SHA1\->build_body_hash($content);
.Ve
.SS "new(%params)"
.IX Subsection "new(%params)"
On the consumer side, you should pass \s-1RSA\s0 private key for consumer_secret,
But for service provider to verify signature, pass \s-1RSA\s0 public key that
consumer register on service provider beforehand.
.PP
\fIparameters\fR
.IX Subsection "parameters"
.IP "consumer_secret" 4
.IX Item "consumer_secret"
.PP
.Vb 3
\& my $signer = OAuth::Lite::SignatureMethod::RSA_SHA1\->new(
\& consumer_secret => $rsa_private_key,
\& );
\&
\& my $verifier = OAuth::Lite::SignatureMethod::RSA_SHA1\->new(
\& consumer_secret => $rsa_public_key,
\& );
.Ve
.SS "sign($base_string)"
.IX Subsection "sign($base_string)"
Generate signature from base string.
.PP
.Vb 1
\& my $signature = $method\->sign($base_string);
.Ve
.ie n .SS "verify($base_string, $signature)"
.el .SS "verify($base_string, \f(CW$signature\fP)"
.IX Subsection "verify($base_string, $signature)"
Verify signature with base string.
.PP
.Vb 4
\& my $signature_is_valid = $method\->verify($base_string, $signature);
\& unless ($signature_is_valid) {
\& say "Signature is invalid!";
\& }
.Ve
.SH "AUTHOR"
.IX Header "AUTHOR"
Lyo Kato, \f(CW\*(C`lyo.kato _at_ gmail.com\*(C'\fR
.SH "COPYRIGHT AND LICENSE"
.IX Header "COPYRIGHT AND LICENSE"
This library is free software; you can redistribute it and/or modify
it under the same terms as Perl itself, either Perl version 5.8.6 or,
at your option, any later version of Perl 5 you may have available.
Copyright 2K16 - 2K18 Indonesian Hacker Rulez