SAML2/Role/XMLCertificate.pm

filter: Statementstmt 100% 16 / 16 Branchbran 100% 2 / 2 Conditioncond n/a MC/DCmcdc n/a Subroutinesub 100% 2 / 2 Podpod 100% 1 / 1 totaltotal 100% 21 / 21 CC 2 SCAR 5.1
CC
2
Cov
100%
get_pem_from_keynode
2.0
BEGIN
1.0
CRAP 1.7
« SAML2/RequestedAttribute.pm ↑ Summary SAML2/Protocol/ArtifactResolve.pm »
1 package Net::SAML2::Role::XMLCertificate;
2 33 ▶use Moose::Role;
Subroutine BEGIN: called CC=1 SCAR=0.0
3  
4 33 our $VERSION = '0.89'; # VERSION
5  
6 # ABSTRACT: Common behaviour for Certificates in XML
7  
8  
9 45 ▶sub get_pem_from_keynode {
Subroutine get_pem_from_keynode: called CC=2 SCAR=6.9
Pod documented
10 45 my $self = shift;
11 45 my $node = shift;
12  
13 45 $node->setNamespace('http://www.w3.org/2000/09/xmldsig#', 'ds');
14  
15 45 my ($text)
16 = $node->findvalue("ds:KeyInfo/ds:X509Data/ds:X509Certificate", $node)
17 =~ /^\s*(.+?)\s*$/s;
18  
19 # rewrap the base64 data from the metadata; it may not
20 # be wrapped at 64 characters as PEM requires
21 45 $text =~ s/\n//g;
22  
23 45 my @lines;
24 45 ▶ while(length $text > 64) {
Branch: 1 branch
BranchTrueFalseTotal
if (length $text > 64) 1052 45 1097
25 1052 push @lines, substr $text, 0, 64, '';
26 }
27 45 push @lines, $text;
28  
29 45 $text = join "\n", @lines;
30  
31 45 return "-----BEGIN CERTIFICATE-----\n$text\n-----END CERTIFICATE-----\n";
32 }
33  
34 33 1;
35  
36 __END__
« SAML2/RequestedAttribute.pm ↑ Summary SAML2/Protocol/ArtifactResolve.pm »