Hi everyone!
I'm working on an RSA project that has to communicate with ASP.NET.
Here's my problem:
I'm following the code here:
http://cpan.uwinnipeg.ca/htdocs/Cryp...Crypt/RSA.html
This code by itself runs fine. However, when I start trying to push out the key to an external file (for later use of course) things start to get a little messy.
-
use Crypt::RSA;
-
-
my $rsa = new Crypt::RSA( ES => 'PKCS1v15' );
-
my $message = "RSA is FUN!!";
-
my ($public, $private) = $rsa->keygen(
-
Identity => 'PTSIntranetApplications@<RMed by MOD>',
-
Size => 1024,
-
Verbosity => 0,
-
Filename => 'key',
-
) or die $rsa->errstr();
-
This Code by itself works okay too. It's only when I try to encrypt it do I run into to problems (note: this is the next set of code right after above code):
-
my $pubKey = new Crypt::RSA::Key::Public( Filename => 'key.public');
-
my $cyphertext = $rsa->encrypt(
-
Message => $message,
-
Key => $pubKey,
-
Armour => 1,
-
) or die $rsa->errstr();
-
I then get this error:
I realize this is from the "Check" function in the RSA object. However, I'm not doing anything to the keys to screw up their values.
Am I doing something wrong? If so, what am I doing and what can I do to fix this problem?
Thanks for your help!
Michael
***EDIT:
I should also note that when using RSA object without any file export/import, it works perfectly fine.