Lite/SignatureMethod.pm

filter: Statementstmt 87.8% 29 / 33 Branchbran 50.0% 3 / 6 Conditioncond n/a MC/DCmcdc n/a Subroutinesub 71.4% 5 / 7 Podpod 0.0% 0 / 4 totaltotal 74.0% 37 / 50 CC 5 SCAR 8.3
CC
5
Cov
82%
verify
3.1
sign
3.0
hmac_hash
2.0
CRAP 2.3
« Lite/RelyingParty/Discover/Parser/HTML.pm ↑ Summary Lite/RelyingParty/Discover/Method/Base.pm »
1 package OpenID::Lite::SignatureMethod;
2  
3 3 ▶use Any::Moose;
Subroutine BEGIN: called CC=1 SCAR=0.0
4 3 ▶use MIME::Base64 ();
Subroutine BEGIN: called CC=1 SCAR=0.0
5  
6 3 ▶sub sign {
Subroutine sign: called CC=3 SCAR=11.0
Pod undocumented
7 3 my ( $self, $secret, $params ) = @_;
8 3 my $signed = $params->get('signed');
9 3 ▶ return unless $signed;
Branch: 1 branch
BranchTrueFalseTotal
unless $signed 0 3 3
10 3 my @signed = split /,/, $signed;
11  
12 3 my $token = '';
13 3 for my $field (@signed) {
14 12 my $v = $params->get($field);
15 12 $token .= "$field:$v\n";
16 }
17 3 my $hash = $self->hmac_hash($secret, $token);
18 3 my $sig = MIME::Base64::encode_base64($hash);
19 3 $sig =~ s/\s+//g;
20 3 return $sig;
21 }
22  
23 2 ▶sub verify {
Subroutine verify: called CC=3 SCAR=11.2
Pod undocumented
24 2 my ( $self, $secret, $params ) = @_;
25 2 my $sig = $params->get('sig');
26 2 ▶ return unless $sig;
Branch: 1 branch
BranchTrueFalseTotal
unless $sig 0 2 2
27 #$sig =~ s/ /+/g;
28 2 my $signed = $self->sign($secret, $params);
29 2 ▶ return unless $signed;
Branch: 1 branch
BranchTrueFalseTotal
unless $signed 0 2 2
30 2 return $sig eq $signed;
31 }
32  
33 0 ▶sub hmac_hash {
Subroutine hmac_hash: not called CC=1 SCAR=6.9
Pod undocumented
34 0 my ( $self, $secret, $key ) = @_;
35 0 die "Abstract Method.";
36 }
37  
38 0 ▶sub hmac_hash_hex {
Subroutine hmac_hash_hex: not called CC=1 SCAR=6.9
Pod undocumented
39 0 my ( $self, $secret, $key ) = @_;
40 0 die "Abstract Method.";
41 }
42  
43 3 ▶no Any::Moose;
Subroutine BEGIN: called CC=1 SCAR=0.0
44 3 __PACKAGE__->meta->make_immutable;
45 3 1;
46  
« Lite/RelyingParty/Discover/Parser/HTML.pm ↑ Summary Lite/RelyingParty/Discover/Method/Base.pm »