Skip to content

Commit 359a0bd

Browse files
committed
Merge XML::Sig version 0.39
1 parent 200c0ae commit 359a0bd

File tree

1 file changed

+6
-4
lines changed

1 file changed

+6
-4
lines changed

lib/Net/SAML2/XML/Sig.pm

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ it -- all in accordance with the W3C standard governing XML signatures.
3535
use vars qw($VERSION @EXPORT_OK %EXPORT_TAGS $DEBUG);
3636

3737
$DEBUG = 0;
38-
# Based on XML::Sig VERSION = '0.38';
38+
# Based on XML::Sig VERSION = '0.39';
3939
$VERSION = '0.29';
4040

4141
use base qw(Class::Accessor);
@@ -391,8 +391,10 @@ sub verify {
391391
print (" Digest Method: $digest_method\n") if $DEBUG;
392392

393393
# Get the DigestValue used to verify Canonical XML
394-
my $refdigest = _trim($self->{ parser }->findvalue(
395-
'dsig:SignedInfo/dsig:Reference/dsig:DigestValue', $signature_node));
394+
# Note that the digest may have embedded newlines in the XML
395+
# Decode the base64 and encode it with no newlines
396+
my $refdigest = encode_base64(decode_base64(_trim($self->{ parser }->findvalue(
397+
'dsig:SignedInfo/dsig:Reference/dsig:DigestValue', $signature_node))), "");
396398
print (" Digest Value: $refdigest\n") if $DEBUG;
397399

398400
# Get the SignatureValue used to verify the SignedInfo
@@ -485,7 +487,7 @@ sub verify {
485487
# Obtain the DigestValue of the Canonical XML
486488
my $digest = $self->{digest_method}->($canonical);
487489

488-
print ( " Reference Digest " . _trim($refdigest) ."\n") if $DEBUG;
490+
print ( " Reference Digest: " . _trim($refdigest) ."\n") if $DEBUG;
489491

490492
print ( " Calculated Digest: ". _trim(encode_base64($digest, '')) ."\n") if $DEBUG;
491493

0 commit comments

Comments
 (0)