Subject: | Bug encodin |
Date: | Mon, 16 Mar 2020 09:49:38 +0100 |
To: | <bug-WSRF-Lite [...] rt.cpan.org> |
From: | "Karol Wolski" <karol.wolski [...] comarch.pl> |
Hello,
I would like report a bug with encoding and proposition to fix it:
diff --git a/perl/site/lib/WSRF/Lite.pm b/perl/site/lib/WSRF/Lite.pm
index 9f5ed01..b8b0cd6 100644
--- a/perl/site/lib/WSRF/Lite.pm
+++ b/perl/site/lib/WSRF/Lite.pm
@@ -6372,6 +6372,9 @@
xmlns:wsse="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecuri
ty-s
return $header, $Body;
}
+use utf8;
+use Encode;
+
sub make_token {
my ( $XML, $Path, $ID ) = @_;
@@ -6393,7 +6396,7 @@ sub make_token {
# print ">>>token-$ID>>>\n$can_token\n<<<token-$ID<<<<\n";
#take digest of token
- my $token_digest = Digest::SHA1::sha1($can_token);
+ my $token_digest =
Digest::SHA1::sha1(encode_utf8($can_token));
#base64 encode digest
$token_digest = MIME::Base64::encode($token_digest);
@@ -6563,7 +6566,7 @@ sub verify {
$parser = XML::LibXML->new();
$doc = $parser->parse_string( $envelope->raw_xml
);
my $CanonicalForm = $doc->toStringEC14N( 0,
$WSRF::WSS::Xpath{Body}, [''] );
- my $token_digest = Digest::SHA1::sha1($CanonicalForm);
+ my $token_digest =
Digest::SHA1::sha1(encode_utf8($CanonicalForm));
$token_digest = MIME::Base64::encode($token_digest);
$SignedStuff{$Signed{Body}} =~ s/\n|\t| //g;
$token_digest =~ s/\n|\t| //g;
Best Regards,
--
Karol Wolski
Comarch SA o/Poznań
GLOBIS, ul. Roosvelta 18
60-829 Poznań
Message body not shown because it is not plain text.