From: Tim V. <ti...@el...> - 2015-05-05 12:07:36
|
Hey guys, I am running into an issue using Crypt::OpenSSL::RSA which I am fairly confident the issue is my fault/lack-of-understanding, but I would really appreciate a kick in the right direction if anyone sees where I've gone wrong as I am probably 95% there. I am using Crypt::OpenSSL::RSA to encrypt a message with a private key (->private_encrypt), and in a separate perl script I am passing the encrypted message to be decrypted (->public_decrypt), using the same version of Crypt::OpenSSL::RSA. When I do the encryption and decryption within the same Perl script (2 subroutines), it all works exactly as expected, however when I break the encryption and the decryption into 2 scripts and pass the encrypted payload between them in a file, I get the OpenSSL error when decrypting in my "decryption" script: "RSA.xs:202: OpenSSL error: data greater than mod len at decrypt.pl line 27" My hunch is random numbers are my problem, and ScriptA and ScriptB are generating different numbers, but I know almost nothing about RSA and could be totally wrong there. I tried using ->import_random_seed(); in both scripts to no avail, however. Attached is 3 files: 1) the script that works, both subroutines in one file => http://pastebin.com/TWYb1LBQ 2) the "encrypt" script (which works fine) => http://pastebin.com/8H8a9k9x 3) the "decrypt" script (which gets the OpenSSL error on decryption) => http://pastebin.com/1TfYypm5 Any help is enormously appreciated! Thanks all! Tim |