line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package OAuth::Lite2::Signer::Algorithms; |
2
|
|
|
|
|
|
|
|
3
|
2
|
|
|
2
|
|
11
|
use strict; |
|
2
|
|
|
|
|
4
|
|
|
2
|
|
|
|
|
123
|
|
4
|
2
|
|
|
2
|
|
13
|
use warnings; |
|
2
|
|
|
|
|
5
|
|
|
2
|
|
|
|
|
74
|
|
5
|
|
|
|
|
|
|
|
6
|
|
|
|
|
|
|
#use OAuth::Lite2::Signer::Algorithm::HMAC_SHA1; |
7
|
2
|
|
|
2
|
|
1134
|
use OAuth::Lite2::Signer::Algorithm::HMAC_SHA256; |
|
2
|
|
|
|
|
25
|
|
|
2
|
|
|
|
|
211
|
|
8
|
|
|
|
|
|
|
|
9
|
|
|
|
|
|
|
my %ALGORITHMS; |
10
|
|
|
|
|
|
|
|
11
|
|
|
|
|
|
|
sub add_algorithm { |
12
|
2
|
|
|
2
|
1
|
4
|
my ($class, $signer) = @_; |
13
|
2
|
|
|
|
|
8
|
$ALGORITHMS{$signer->name} = $signer; |
14
|
|
|
|
|
|
|
} |
15
|
|
|
|
|
|
|
|
16
|
|
|
|
|
|
|
#__PACKAGE__->add_algorithm( OAuth::Lite2::Signer::Algorithm::HMAC_SHA1->new ); |
17
|
|
|
|
|
|
|
__PACKAGE__->add_algorithm( OAuth::Lite2::Signer::Algorithm::HMAC_SHA256->new ); |
18
|
|
|
|
|
|
|
|
19
|
|
|
|
|
|
|
sub get_algorithm { |
20
|
4
|
|
|
4
|
1
|
6
|
my ($class, $name) = @_; |
21
|
4
|
|
|
|
|
27
|
return $ALGORITHMS{$name}; |
22
|
|
|
|
|
|
|
} |
23
|
|
|
|
|
|
|
|
24
|
|
|
|
|
|
|
=head1 NAME |
25
|
|
|
|
|
|
|
|
26
|
|
|
|
|
|
|
OAuth::Lite2::Signer::Algorithms - signature algorithms |
27
|
|
|
|
|
|
|
|
28
|
|
|
|
|
|
|
=head1 SYNOPSIS |
29
|
|
|
|
|
|
|
|
30
|
|
|
|
|
|
|
my $algorithm = OAuth::Lite2::Signer::Algorithms->get_algorithm('hmac-sha256'); |
31
|
|
|
|
|
|
|
my $signature = $algorithm->hash($key, $text); |
32
|
|
|
|
|
|
|
|
33
|
|
|
|
|
|
|
=head1 DESCRIPTION |
34
|
|
|
|
|
|
|
|
35
|
|
|
|
|
|
|
DEPRECATED. algorithm object store for OAuth 2.0 signature. |
36
|
|
|
|
|
|
|
|
37
|
|
|
|
|
|
|
=head1 METHODS |
38
|
|
|
|
|
|
|
|
39
|
|
|
|
|
|
|
=head2 add_algorithm( $signer ) |
40
|
|
|
|
|
|
|
|
41
|
|
|
|
|
|
|
Add signer algorithm object. the class should be L or its child. |
42
|
|
|
|
|
|
|
L is automatically added by default. |
43
|
|
|
|
|
|
|
|
44
|
|
|
|
|
|
|
=head2 get_algorithm( $algorithm_name ) |
45
|
|
|
|
|
|
|
|
46
|
|
|
|
|
|
|
Get algorithm object by its name. |
47
|
|
|
|
|
|
|
|
48
|
|
|
|
|
|
|
my $algorithm = OAuth::Lite2::Signer::Algorithms->get_algorithm('hmac-sha256'); |
49
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
=head1 SEE ALSO |
51
|
|
|
|
|
|
|
|
52
|
|
|
|
|
|
|
L |
53
|
|
|
|
|
|
|
L |
54
|
|
|
|
|
|
|
L |
55
|
|
|
|
|
|
|
|
56
|
|
|
|
|
|
|
=head1 AUTHOR |
57
|
|
|
|
|
|
|
|
58
|
|
|
|
|
|
|
Lyo Kato, Elyo.kato@gmail.comE |
59
|
|
|
|
|
|
|
|
60
|
|
|
|
|
|
|
=head1 COPYRIGHT AND LICENSE |
61
|
|
|
|
|
|
|
|
62
|
|
|
|
|
|
|
Copyright (C) 2010 by Lyo Kato |
63
|
|
|
|
|
|
|
|
64
|
|
|
|
|
|
|
This library is free software; you can redistribute it and/or modify |
65
|
|
|
|
|
|
|
it under the same terms as Perl itself, either Perl version 5.8.8 or, |
66
|
|
|
|
|
|
|
at your option, any later version of Perl 5 you may have available. |
67
|
|
|
|
|
|
|
|
68
|
|
|
|
|
|
|
=cut |
69
|
|
|
|
|
|
|
|
70
|
|
|
|
|
|
|
|
71
|
|
|
|
|
|
|
1; |