| 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
| |||||||||||
| 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__ | ||||||||||