blib/lib/XML/Compile/WSS/Sign.pm untested

filter: Statementstmt 0.0% 0 / 41 Branchbran 0.0% 0 / 10 Conditioncond 0.0% 0 / 9 MC/DCmcdc n/a Subroutinesub 0.0% 0 / 10 Podpod 0.0% 0 / 4 totaltotal 0.0% 0 / 74 CC 6 SCAR 24.7
CC
6
Cov
0%
new
30.0
fromConfig
6.0
init
2.0
CRAP 11.9
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 use warnings;
6 use strict;
7  
8 package XML::Compile::WSS::Sign;
9 use vars '$VERSION';
10 $VERSION = '2.02';
11  
12  
13 use Log::Report 'xml-compile-wss-sig';
14  
15 use XML::Compile::WSS::Util qw/:wss11 :dsig/;
16 use Scalar::Util qw/blessed/;
17  
18 my ($signs, $sigmns) = (DSIG_NS, DSIG_MORE_NS);
19  
20  
21 sub new(@)
22 { my $class = shift;
23 my $args = @_==1 ? shift : {@_};
24  
25 $args->{sign_method} ||= delete $args->{type}; # pre 2.00
26 my $algo = $args->{sign_method} ||= DSIG_RSA_SHA1;
27  
28 if($class eq __PACKAGE__)
29 { if($algo =~ qr/^(?:\Q$signs\E|\Q$sigmns\E)([a-z0-9]+)\-([a-z0-9]+)$/)
30 { my $algo = uc $1;;
31 $args->{hashing} ||= uc $2;
32 $class .= '::'.$algo;
33 }
34 else
35 { error __x"unsupported sign algorithm `{algo}'", algo => $algo;
36 }
37 eval "require $class"; panic $@ if $@;
38 }
39  
40 (bless {}, $class)->init($args);
41 }
42  
43 sub init($)
44 { my ($self, $args) = @_;
45 $self->{XCWS_sign_method} = $args->{sign_method};
46 $self;
47 }
48  
49  
50 sub fromConfig($)
51 { my $class = shift;
52 $class->new(@_==1 ? %{$_[0]} : @_);
53 }
54  
55 #-----------------
56  
57 sub signMethod() {shift->{XCWS_sign_method}}
58  
59 #-----------------
60  
61 #-----------------
62  
63 1;