Branch Coverage

blib/lib/Net/SAML2/XML/Sig.pm
Criterion Covered Total %
branch 92 242 38.0


line true false branch
55 7 11 if (exists $params->{$prop})
63 5 1 exists $params->{'x509'} ? :
64 3 3 if (exists $params->{'key'})
67 3 3 if (exists $params->{'cert'})
70 1 5 if (exists $params->{'cert_text'})
74 0 6 if (exists $params->{'sig_hash'} and grep {$_ eq $params->{'sig_hash'};} 'sha224', 'sha256', 'sha384', 'sha512') { }
82 0 6 if (exists $params->{'digest_hash'} and grep {$_ eq $params->{'digest_hash'};} 'sha1', 'sha224', 'sha256', 'sha384', 'sha512') { }
90 0 6 if (defined $self->{'key_type'} and $self->{'key_type'} eq "dsa")
91 0 0 if (defined $params->{'sig_hash'} and grep {$_ eq $params->{'sig_hash'};} 'sha1', 'sha256') { }
99 4 2 if (exists $params->{'no_xml_declaration'} and $params->{'no_xml_declaration'} == 1) { }
113 0 3 unless $self->key
129 0 3 if $Net::SAML2::XML::Sig::DEBUG
148 0 4 if $Net::SAML2::XML::Sig::DEBUG
162 4 0 if (my $ref = 'Digest::SHA'->can($self->{'digest_hash'})) { }
172 0 4 if $Net::SAML2::XML::Sig::DEBUG
176 0 4 if $Net::SAML2::XML::Sig::DEBUG
201 0 4 if ($self->{'key_type'} eq 'dsa') { }
0 4 elsif ($self->{'key_type'} eq 'ecdsa') { }
202 0 0 if $Net::SAML2::XML::Sig::DEBUG
203 0 0 if (my $ref = 'Digest::SHA'->can($self->{'sig_hash'})) { }
227 0 0 if $Net::SAML2::XML::Sig::DEBUG
239 0 4 if $Net::SAML2::XML::Sig::DEBUG
252 0 4 if $Net::SAML2::XML::Sig::DEBUG
280 0 5 if $Net::SAML2::XML::Sig::DEBUG
286 0 6 if $Net::SAML2::XML::Sig::DEBUG
293 0 6 if $Net::SAML2::XML::Sig::DEBUG
299 0 6 unless ($self->{'parser'}->findvalue("//*[\@ID='" . $reference . "']"))
300 0 0 if $Net::SAML2::XML::Sig::DEBUG
301 0 0 if ($numsigs <= 1) { }
313 0 6 if $Net::SAML2::XML::Sig::DEBUG
320 0 6 if $Net::SAML2::XML::Sig::DEBUG
324 0 6 if $Net::SAML2::XML::Sig::DEBUG
335 0 6 if $Net::SAML2::XML::Sig::DEBUG
341 0 6 if $Net::SAML2::XML::Sig::DEBUG
343 6 0 if (my $ref = 'Digest::SHA'->can($signature_method)) { }
350 6 0 if (my $ref = 'Digest::SHA'->can($digest_method)) { }
359 3 3 if (defined $self->{'cert_obj'}) { }
361 0 3 unless ($self->_verify_x509_cert($self->{'cert_obj'}, $signed_info_canon, $signature))
378 3 0 if ($key_info_sig_type eq 'X509Data') { }
387 3 0 if ($keyinfo_nodeset->size)
389 0 3 if $Net::SAML2::XML::Sig::DEBUG
390 0 3 if (not $self->$verify_method($keyinfo_nodeset->get_node(0), $signed_info_canon, $signature)) { }
392 0 0 if $Net::SAML2::XML::Sig::DEBUG
396 0 3 if $Net::SAML2::XML::Sig::DEBUG
401 0 3 unless $keyinfo_nodeset and $keyinfo_nodeset->size > 0
422 0 6 if $Net::SAML2::XML::Sig::DEBUG
424 0 6 if $Net::SAML2::XML::Sig::DEBUG
427 0 6 unless $refdigest eq _trim(&encode_base64($digest, ""))
429 0 6 if $Net::SAML2::XML::Sig::DEBUG
462 0 4 unless $i
484 0 4 unless $id
508 0 6 if $Net::SAML2::XML::Sig::DEBUG
537 0 6 if $Net::SAML2::XML::Sig::DEBUG
541 0 12 if $Net::SAML2::XML::Sig::DEBUG
542 6 6 if ($alg eq 'http://www.w3.org/2000/09/xmldsig#enveloped-signature') { }
0 6 elsif ($alg eq 'http://www.w3.org/TR/2001/REC-xml-c14n-20010315') { }
0 6 elsif ($alg eq 'http://www.w3.org/TR/2001/REC-xml-c14n-20010315#WithComments') { }
6 0 elsif ($alg eq 'http://www.w3.org/2001/10/xml-exc-c14n#') { }
0 0 elsif ($alg eq 'http://www.w3.org/2001/10/xml-exc-c14n#WithComments') { }
548 0 0 if $Net::SAML2::XML::Sig::DEBUG
552 0 0 if $Net::SAML2::XML::Sig::DEBUG
557 0 6 if $Net::SAML2::XML::Sig::DEBUG
562 0 0 if $Net::SAML2::XML::Sig::DEBUG
589 0 0 if ($child)
626 0 0 if $rsa_pub->verify($canonical, $bin_signature)
645 0 3 if ref $cert
683 0 3 if $@
715 0 6 if ($cert->key_alg_name eq 'id-ecPublicKey') { }
0 6 elsif ($cert->key_alg_name eq 'dsaEncryption') { }
716 0 0 unless eval {
725 0 0 if ($ecdsa_pub->verify_message_rfc7518($bin_signature, $canonical, uc $self->{'sig_hash'}))
734 0 0 if $@
748 0 0 if ($dsa_pub->do_verify($self->{'sig_method'}->($canonical), $sigobj))
757 0 6 if $@
765 6 0 if ($rsa_pub->verify($canonical, $bin_signature))
843 0 0 if $@
875 0 0 if $dsa_pub->do_verify($self->{'sig_method'}->($canonical), $sigobj)
895 0 0 unless eval {
939 0 0 if $ecdsa_pub->verify_message_rfc7518($bin_signature, $canonical, uc $self->{'sig_hash'})
959 6 4 if ($context) { }
974 0 0 if ($node) { }
986 0 0 if (defined $self->{'dsig_prefix'} and length $self->{'dsig_prefix'})
1032 0 0 unless eval {
1038 0 0 if ($ecdsa_key) { }
1088 0 0 if $@
1092 0 0 if ($dsa_key) { }
1136 0 3 if $@
1140 3 0 if ($rsaKey) { }
1145 1 2 if (not $self->{'x509'})
1187 0 0 if $@
1192 0 0 if ($x509Key) { }
1221 0 3 if $@
1224 3 0 if (open my $CERT, '<', $file) { }
1231 3 0 if ($cert) { }
1267 0 1 if $@
1271 1 0 if ($cert) { }
1297 3 0 if (open my $KEY, '<', $file) { }
1303 3 0 if ($text =~ /BEGIN ([DR]SA) PRIVATE KEY/) { }
0 0 elsif ($text =~ /BEGIN EC PRIVATE KEY/) { }
0 0 elsif ($text =~ /BEGIN PRIVATE KEY/) { }
0 0 elsif ($text =~ /BEGIN CERTIFICATE/) { }
1306 3 0 if ($key_used eq 'RSA') { }
1368 4 0 if ($self->{'sig_hash'} eq 'sha1' and $self->{'key_type'} ne 'ecdsa') { }
0 0 elsif ($self->{'key_type'} eq 'ecdsa') { }
0 0 elsif ($self->{'key_type'} eq 'dsa' and $self->{'sig_hash'} eq 'sha256') { }
1406 4 0 if ($self->{'digest_hash'} eq 'sha1') { }
0 0 elsif ($self->{'digest_hash'} eq 'sha224' or $self->{'digest_hash'} eq 'sha384') { }
1443 0 10 if $Net::SAML2::XML::Sig::DEBUG
1451 0 10 if $Net::SAML2::XML::Sig::DEBUG
1452 0 10 if ($alg eq 'http://www.w3.org/TR/2001/REC-xml-c14n-20010315') { }
9 1 elsif ($alg eq 'http://www.w3.org/TR/2001/REC-xml-c14n-20010315#WithComments') { }
0 1 elsif ($alg eq 'http://www.w3.org/TR/2008/REC-xml-c14n11-20080502') { }
0 1 elsif ($alg eq 'http://www.w3.org/TR/2008/REC-xml-c14n11-20080502#WithComments') { }
1 0 elsif ($alg eq 'http://www.w3.org/2001/10/xml-exc-c14n#') { }
0 0 elsif ($alg eq 'http://www.w3.org/2001/10/xml-exc-c14n#WithComments') { }
1453 0 0 if $Net::SAML2::XML::Sig::DEBUG
1457 0 9 if $Net::SAML2::XML::Sig::DEBUG
1461 0 0 if $Net::SAML2::XML::Sig::DEBUG
1465 0 0 if $Net::SAML2::XML::Sig::DEBUG
1469 0 1 if $Net::SAML2::XML::Sig::DEBUG
1473 0 0 if $Net::SAML2::XML::Sig::DEBUG