line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
# Copyrights 2012-2013 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.01. |
5
|
1
|
|
|
1
|
|
2283
|
use warnings; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
40
|
|
6
|
1
|
|
|
1
|
|
5
|
use strict; |
|
1
|
|
|
|
|
3
|
|
|
1
|
|
|
|
|
51
|
|
7
|
|
|
|
|
|
|
|
8
|
|
|
|
|
|
|
package XML::Compile::WSS::Sign; |
9
|
1
|
|
|
1
|
|
5
|
use vars '$VERSION'; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
60
|
|
10
|
|
|
|
|
|
|
$VERSION = '2.01'; |
11
|
|
|
|
|
|
|
|
12
|
|
|
|
|
|
|
|
13
|
1
|
|
|
1
|
|
5
|
use Log::Report 'xml-compile-wss-sig'; |
|
1
|
|
|
|
|
3
|
|
|
1
|
|
|
|
|
8
|
|
14
|
|
|
|
|
|
|
|
15
|
1
|
|
|
1
|
|
745
|
use XML::Compile::WSS::Util qw/:wss11 :dsig/; |
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
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; |