| 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
| |||||||||||||||||||||
| 24 | |||||||||||||||||||||
| 25 | 5 | ▶ | $args->{sign_method} ||= delete $args->{type}; # pre 2.00 | ||||||||||||||||||
|
Condition66%2/3
$args->{"sign_method"} ||= delete $args->{"type"}
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"}
| |||||||||||||||||||||
| 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"
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"}
| |||||||||||||||||||||
| 27 | |||||||||||||||||||||
| 28 | 5 | ▶ | if($class eq __PACKAGE__) | ||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||
| 29 | 5 | ▶ | { if($algo =~ qr/^(?:\Q$signs\E|\Q$sigmns\E)([a-z0-9]+)\-([a-z0-9]+)$/) | ||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||
| 30 | 5 | { my $algo = uc $1;; | |||||||||||||||||||
| 31 | 5 | ▶ | $args->{hashing} ||= uc $2; | ||||||||||||||||||
|
Condition33%1/3
$args->{"hashing"} ||= uc $2
MC/DC0%0/2
$args->{"hashing"} ||= uc $2
$args->{"hashing"}
uc $2
Truth table33%1/3
A ||= B
A= $args->{"hashing"}B= uc $2
| |||||||||||||||||||||
| 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
| |||||||||||||||||||||
| 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
| |||||||||||||||||||||
| 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; | |||||||||||||||||||