Beefy Boxes and Bandwidth Generously Provided by pair Networks
The stupid question is the question not asked
 
PerlMonks  

Re: Help verifying RSA PSS signature in Perl with Crypt::RSA and Crypt::RSA::SS::PSS

by Khen1950fx (Canon)
on Mar 31, 2013 at 20:22 UTC ( #1026382=note: print w/ replies, xml ) Need Help??


in reply to Help verifying RSA PSS signature in Perl with Crypt::RSA and Crypt::RSA::SS::PSS

It verified for me by passing trial division:

#!/usr/bin/perl -l use strict 'refs'; use warnings FATAL => 'syntax'; use Crypt::RSA::Key; use Crypt::RSA::Key::Public; use Crypt::RSA::Key::Private; use Crypt::RSA::SS::PSS; use Math::Pari qw(PARI); my ($message, $rsa, $pss, $signature, $verify); my ($public, $private); $message = "hello"; $rsa = new Crypt::RSA::Key; ($public, $private) = $rsa->generate( Size => 1024, Verbosity => 2, Filename => "key", ) or die $rsa->errstr(); $pss = new Crypt::RSA::SS::PSS; $signature = $pss->sign( Message => $message, Key => $private, ) || die $pss->errstr; $verify = $pss->verify( Message => $message, Key => $public, Signature => $signature, ) || die $pss->errstr; my $i = 0; foreach $verify(1 .. 10) { print $verify ? "ok" : "not ok"; print " ", ++$i; sleep 1; } my $key = new Crypt::RSA::Key::Public( Filename => "key.public", ); $signature = pack("H*", '03808458..73E92'); foreach $verify(1 .. 10) { print $key ? "ok" : "not ok"; print " ", ++$i; sleep 1; }


Comment on Re: Help verifying RSA PSS signature in Perl with Crypt::RSA and Crypt::RSA::SS::PSS
Download Code
Re^2: Help verifying RSA PSS signature in Perl with Crypt::RSA and Crypt::RSA::SS::PSS
by cryptques (Novice) on Apr 01, 2013 at 13:31 UTC

    Yes, Khen1950fx, I'm also able to verify most of the time with a key that I generate (as in your example. However, sometimes it fails with the error I posted above. Also, the problem is trying to verify with a public key that I've gotten from another device

    (By the way, my code snippet "$signature = pack("H*", '03808458..73E92'); " was just an example (so I wouldn't have to include the whole hex-string signature)).

      I didn't feel like writing the whole hex-string either:).

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://1026382]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others wandering the Monastery: (7)
As of 2014-07-10 00:47 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    When choosing user names for websites, I prefer to use:








    Results (198 votes), past polls