line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Net::OAuth::SignatureMethod::HMAC_SHA256; |
2
|
1
|
|
|
1
|
|
7
|
use warnings; |
|
1
|
|
|
|
|
1
|
|
|
1
|
|
|
|
|
37
|
|
3
|
1
|
|
|
1
|
|
5
|
use strict; |
|
1
|
|
|
|
|
1
|
|
|
1
|
|
|
|
|
30
|
|
4
|
1
|
|
|
1
|
|
4
|
use Digest::SHA (); |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
13
|
|
5
|
1
|
|
|
1
|
|
859
|
use MIME::Base64 (); |
|
1
|
|
|
|
|
872
|
|
|
1
|
|
|
|
|
158
|
|
6
|
|
|
|
|
|
|
|
7
|
|
|
|
|
|
|
sub sign { |
8
|
2
|
|
|
2
|
0
|
13
|
my $self = shift; |
9
|
2
|
|
|
|
|
3
|
my $request = shift; |
10
|
2
|
|
|
|
|
17
|
my $hmac_digest = Digest::SHA::hmac_sha256( |
11
|
|
|
|
|
|
|
$request->signature_base_string, $request->signature_key |
12
|
|
|
|
|
|
|
); |
13
|
2
|
|
|
|
|
32
|
return MIME::Base64::encode_base64($hmac_digest, ''); |
14
|
|
|
|
|
|
|
} |
15
|
|
|
|
|
|
|
|
16
|
|
|
|
|
|
|
sub verify { |
17
|
1
|
|
|
1
|
0
|
2
|
my $self = shift; |
18
|
1
|
|
|
|
|
3
|
my $request = shift; |
19
|
1
|
|
|
|
|
6
|
return $request->signature eq $self->sign($request); |
20
|
|
|
|
|
|
|
} |
21
|
|
|
|
|
|
|
|
22
|
|
|
|
|
|
|
=head1 NAME |
23
|
|
|
|
|
|
|
|
24
|
|
|
|
|
|
|
Net::OAuth::SignatureMethod::HMAC_SHA256 - HMAC_SHA256 Signature Method for OAuth protocol |
25
|
|
|
|
|
|
|
|
26
|
|
|
|
|
|
|
=head1 SEE ALSO |
27
|
|
|
|
|
|
|
|
28
|
|
|
|
|
|
|
L, L |
29
|
|
|
|
|
|
|
|
30
|
|
|
|
|
|
|
=head1 AUTHOR |
31
|
|
|
|
|
|
|
|
32
|
|
|
|
|
|
|
Keith Grennan, C<< >> |
33
|
|
|
|
|
|
|
|
34
|
|
|
|
|
|
|
=head1 COPYRIGHT & LICENSE |
35
|
|
|
|
|
|
|
|
36
|
|
|
|
|
|
|
Copyright 2012 Keith Grennan, all rights reserved. |
37
|
|
|
|
|
|
|
|
38
|
|
|
|
|
|
|
This program is free software; you can redistribute it and/or modify it |
39
|
|
|
|
|
|
|
under the same terms as Perl itself. |
40
|
|
|
|
|
|
|
|
41
|
|
|
|
|
|
|
=cut |
42
|
|
|
|
|
|
|
|
43
|
|
|
|
|
|
|
1; |