Subject: | Crypt::OpenSSL::DSA::do_verify() -- sig is not a blessed SV reference at |
Hi
I am working on XML::Sig for the verification of DSA signed XML.
I have a signature value from:
my $bin_signature = $self->{key_obj}->sign( sha1($signed_info_canon) );
that is stored as a base64 encoded string in an XML file.
To verify an XML I retrieve and decode that to get the signature again to verify with the public key:
my ($context,$canonical,$sig) = @_;
eval {
require Crypt::OpenSSL::DSA;
};
# Generate Public Key from XML
my $p = decode_base64(_trim($self->{parser}->findvalue('dsig:P', $context)));
my $q = decode_base64(_trim($self->{parser}->findvalue('dsig:Q', $context)));
my $g = decode_base64(_trim($self->{parser}->findvalue('dsig:G', $context)));
my $y = decode_base64(_trim($self->{parser}->findvalue('dsig:Y', $context)));
my $dsa_pub = Crypt::OpenSSL::DSA->new();
$dsa_pub->set_p($p);
$dsa_pub->set_q($q);
$dsa_pub->set_g($g);
$dsa_pub->set_pub_key($y);
my $bin_signature = decode_base64($sig);
# DSA signatures are limited to a message body of 20 characters, so a sha1 digest is taken
return 1 if ($dsa_pub->do_verify( $self->{digest_method}->($canonical), $bin_signature ));
As I understand it, passing the signature to do_verify would allow you to use the full signature object,
I assume it is because Perl does nt know that $bin_signature is a Crypt::OpenSSL::DSA::Signature.
Any idea how to proceed?
Tim