| 1 | package Net::OAuth::SignatureMethod::HMAC_SHA1; | ||||||||||||||||||||
| 2 | |||||||||||||||||||||
| 3 | 9 | ▶ | use warnings; | ||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||
| 4 | 9 | ▶ | use strict; | ||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||
| 5 | |||||||||||||||||||||
| 6 | 9 | ▶ | use base 'Net::OAuth::SignatureMethod'; | ||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||
| 7 | |||||||||||||||||||||
| 8 | 9 | ▶ | use Carp; | ||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||
| 9 | 9 | ▶ | use Digest::SHA (); | ||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||
| 10 | 9 | ▶ | use MIME::Base64; | ||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||
| 11 | |||||||||||||||||||||
| 12 | 43 | ▶ | sub sign { | ||||||||||||||||||
|
Subroutine
sign: called CC=3 SCAR=11.3
Pod
undocumented
| |||||||||||||||||||||
| 13 | 43 | my $self = shift; | |||||||||||||||||||
| 14 | 43 | my $request = shift; | |||||||||||||||||||
| 15 | 43 | ▶ | croak "Cannot use a blank signature_key" unless length( $request->signature_key || "" ) > 0; | ||||||||||||||||||
|
Branch: 1 branch
Condition50%1/2
$request->signature_key || ''
MC/DC0%0/1
$request->signature_key || ''
$request->signature_key
Truth table50%1/2
A
A= $request->signature_key
| |||||||||||||||||||||
| 16 | 43 | my $hmac_digest = Digest::SHA::hmac_sha1( | |||||||||||||||||||
| 17 | $request->signature_base_string, $request->signature_key | ||||||||||||||||||||
| 18 | ); | ||||||||||||||||||||
| 19 | 43 | return encode_base64($hmac_digest, ''); | |||||||||||||||||||
| 20 | } | ||||||||||||||||||||
| 21 | |||||||||||||||||||||
| 22 | 17 | ▶ | sub verify { | ||||||||||||||||||
|
Subroutine
verify: called CC=1 SCAR=0.0
Pod
undocumented
| |||||||||||||||||||||
| 23 | 17 | my $self = shift; | |||||||||||||||||||
| 24 | 17 | my $request = shift; | |||||||||||||||||||
| 25 | 17 | return $self->secure_compare( $request->signature, $self->sign($request) ); | |||||||||||||||||||
| 26 | } | ||||||||||||||||||||
| 27 | |||||||||||||||||||||
| 28 | =head1 NAME | ||||||||||||||||||||
| 29 | |||||||||||||||||||||
| 30 | Net::OAuth::SignatureMethod::HMAC_SHA1 - HMAC_SHA1 Signature Method for OAuth protocol | ||||||||||||||||||||
| 31 | |||||||||||||||||||||
| 32 | =head1 SEE ALSO | ||||||||||||||||||||
| 33 | |||||||||||||||||||||
| 34 | L<Net::OAuth>, L<http://oauth.net> | ||||||||||||||||||||
| 35 | |||||||||||||||||||||
| 36 | =head1 AUTHOR | ||||||||||||||||||||
| 37 | |||||||||||||||||||||
| 38 | Originally by Keith Grennan <foss@nearlyfree.org> | ||||||||||||||||||||
| 39 | |||||||||||||||||||||
| 40 | Currently maintained by Robert Rothenberg <perl@rhizomnic.com> | ||||||||||||||||||||
| 41 | |||||||||||||||||||||
| 42 | =head1 COPYRIGHT & LICENSE | ||||||||||||||||||||
| 43 | |||||||||||||||||||||
| 44 | Copyright 2007-2012, 2024-2026 Keith Grennan | ||||||||||||||||||||
| 45 | |||||||||||||||||||||
| 46 | This program is free software; you can redistribute it and/or modify it | ||||||||||||||||||||
| 47 | under the same terms as Perl itself. | ||||||||||||||||||||
| 48 | |||||||||||||||||||||
| 49 | =cut | ||||||||||||||||||||
| 50 | |||||||||||||||||||||
| 51 | 9 | 1; | |||||||||||||||||||