OAuth/SignatureMethod/HMAC_SHA1.pm

filter: Statementstmt 100% 27 / 27 Branchbran 50.0% 1 / 2 Conditioncond 50.0% 1 / 2 MC/DCmcdc 0.0% 0 / 1 Subroutinesub 100% 8 / 8 Podpod 0.0% 0 / 2 totaltotal 88.1% 37 / 42 CC 3 SCAR 4.9
CC
3
Cov
94%
sign
3.1
BEGIN
1.0
BEGIN
1.0
CRAP 1.6
« OAuth/V1_0A/UserAuthResponse.pm ↑ Summary OAuth/SignatureMethod/HMAC_SHA256.pm »
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
BranchTrueFalseTotal
unless length($request->signature_key || "") > 0 0 43 43
Condition50%1/2
$request->signature_key || ''
l!l
430
MC/DC0%0/1
$request->signature_key || ''
$request->signature_key
Truth table50%1/2
A
A= $request->signature_key
Aresult
11
00
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;
« OAuth/V1_0A/UserAuthResponse.pm ↑ Summary OAuth/SignatureMethod/HMAC_SHA256.pm »