# $digest contains the digest of the message (confirmed to be correct)
my $SignedInfo = <<EOT;
<SignedInfo>
<CanonicalizationMethod Algorithm="http://www.w3.org/2001/10/xml-exc-c14n#" />
<SignatureMethod Algorithm="http://www.w3.org/2001/04/xmldsig-more#rsa-sha256" />
<Reference URI="">
<Transforms>
<Transform Algorithm="http://www.w3.org/2000/09/xmldsig#enveloped-signature" />
</Transforms>
<DigestMethod Algorithm="http://www.w3.org/2001/04/xmlenc#sha256" />
<DigestValue>$digest</DigestValue>
</Reference>
</SignedInfo>
EOT
# SignedInfo needs to be signed using RSAWithSHA256
my $dataToSign = _CanonicalizeXML( $signedInfo, 1 ); # Does exclusive canonicalization
my $pkrsa = Crypt::PK::RSA->new( "priv.pem", $password );
my $sig = $pkrsa->sign_message( $dataToSign, "SHA256", "v1.5" );
$sig = encode_base64( $sig );
chomp( $sig );
.
. I then continue building the XML message.
.
sub _CanonicalizeXML {
my ($xml, $exclusive) = @_;
my $xpath = '<XPath>(//. | //@* | //namespace::*)</XPath>';
return XML::CanonicalizeXML::canonicalize( $xml, $xpath, [], $exclusive, 0 );
}
When I send the XML message to the iDEAL server, it returns "invalid digital signture"...
In reply to Re^2: AES support for Crypt::OpenSSL::RSA?
by Zippy1970
in thread AES support for Crypt::OpenSSL::RSA?
by Zippy1970
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |