lib/XML/Compile/WSS/Sign.pm

filter: Statementstmt 95.1% 39 / 41 Branchbran 50.0% 5 / 10 Conditioncond 62.5% 5 / 8 MC/DCmcdc 40.0% 2 / 5 Subroutinesub 100% 10 / 10 Podpod 75.0% 3 / 4 totaltotal 82.0% 64 / 78 CC 9 SCAR 15.8
CC
9
Cov
83%
new
9.3
fromConfig
2.3
BEGIN
1.0
CRAP 4.8
« blib/lib/XML/Compile/WSS/SignedInfo.pm ↑ Summary lib/XML/Compile/WSS/SignedInfo.pm »
1 # Copyrights 2012-2016 by [Mark Overmeer].
2 # For other contributors see ChangeLog.
3 # See the manual pages for details on the licensing terms.
4 # Pod stripped from pm file by OODoc 2.02.
5 5 ▶use warnings;
Subroutine BEGIN: called CC=1 SCAR=0.0
6 5 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
7  
8 package XML::Compile::WSS::Sign;
9 5 ▶use vars '$VERSION';
Subroutine BEGIN: called CC=1 SCAR=0.0
10 5 $VERSION = '2.02';
11  
12  
13 5 ▶use Log::Report 'xml-compile-wss-sig';
Subroutine BEGIN: called CC=1 SCAR=0.0
14  
15 5 ▶use XML::Compile::WSS::Util qw/:wss11 :dsig/;
Subroutine BEGIN: called CC=1 SCAR=0.0
16 5 ▶use Scalar::Util qw/blessed/;
Subroutine BEGIN: called CC=1 SCAR=0.0
17  
18 5 my ($signs, $sigmns) = (DSIG_NS, DSIG_MORE_NS);
19  
20  
21 sub new(@)
22 5 ▶{ my $class = shift;
Subroutine new: called CC=8 SCAR=22.3
Pod documented
23 5 ▶ my $args = @_==1 ? shift : {@_};
Branch: 1 branch
BranchTrueFalseTotal
@_ == 1 ? : 0 5 5
24  
25 5 ▶ $args->{sign_method} ||= delete $args->{type}; # pre 2.00
Condition66%2/3
$args->{"sign_method"} ||= delete $args->{"type"}
l!l&&r!l&&!r
203
MC/DC50%1/2
$args->{"sign_method"} ||= delete $args->{"type"}
$args->{"sign_method"} delete $args->{"type"}
Truth table66%2/3
A ||= B
A= $args->{"sign_method"}B= delete $args->{"type"}
ABresult
1X1
011
000
26 5 ▶ my $algo = $args->{sign_method} ||= DSIG_RSA_SHA1;
Condition100%2/2
$args->{"sign_method"} ||= "http://www.w3.org/2000/09/xmldsig#rsa-sha1"
l!l
23
MC/DC100%1/1
$args->{"sign_method"} ||= "http://www.w3.org/2000/09/xmldsig#rsa-sha1"
$args->{"sign_method"}
Truth table100%2/2
A
A= $args->{"sign_method"}
Aresult
11
00
27  
28 5 ▶ if($class eq __PACKAGE__)
Branch: 1 branch
BranchTrueFalseTotal
if ($class eq __PACKAGE__) 5 0 5
29 5 ▶ { if($algo =~ qr/^(?:\Q$signs\E|\Q$sigmns\E)([a-z0-9]+)\-([a-z0-9]+)$/)
Branch: 1 branch
BranchTrueFalseTotal
if ($algo =~ qr/^(?:\Q$signs\E|\Q$sigmns\E)([a-z0-9]+)\-([a-z0-9]+)$/) { } 5 0 5
30 5 { my $algo = uc $1;;
31 5 ▶ $args->{hashing} ||= uc $2;
Condition33%1/3
$args->{"hashing"} ||= uc $2
l!l&&r!l&&!r
050
MC/DC0%0/2
$args->{"hashing"} ||= uc $2
$args->{"hashing"} uc $2
Truth table33%1/3
A ||= B
A= $args->{"hashing"}B= uc $2
ABresult
1X1
011
000
32 5 $class .= '::'.$algo;
33 }
34 else
35 0 { error __x"unsupported sign algorithm `{algo}'", algo => $algo;
36 }
37 5 ▶ eval "require $class"; panic $@ if $@;
Branch: 1 branch
BranchTrueFalseTotal
if $@ 0 5 5
38 }
39  
40 5 (bless {}, $class)->init($args);
41 }
42  
43 sub init($)
44 5 ▶{ my ($self, $args) = @_;
Subroutine init: called CC=1 SCAR=0.0
Pod undocumented
45 5 $self->{XCWS_sign_method} = $args->{sign_method};
46 5 $self;
47 }
48  
49  
50 sub fromConfig($)
51 4 ▶{ my $class = shift;
Subroutine fromConfig: called CC=2 SCAR=8.1
Pod documented
52 4 ▶ $class->new(@_==1 ? %{$_[0]} : @_);
Branch: 1 branch
BranchTrueFalseTotal
@_ == 1 ? : 0 4 4
53 }
54  
55 #-----------------
56  
57 2 ▶sub signMethod() {shift->{XCWS_sign_method}}
Subroutine signMethod: called CC=1 SCAR=0.0
Pod documented
58  
59 #-----------------
60  
61 #-----------------
62  
63 5 1;
« blib/lib/XML/Compile/WSS/SignedInfo.pm ↑ Summary lib/XML/Compile/WSS/SignedInfo.pm »