> I'm using RSA to encrypt/decrypt some text. I encrypt the data using the > private key and then decrypt it using RSA_public_decrypt(). One thing i > noticed was that if the data was not encrypted using the correct > private key > that RSA_public_decrypt() will just set the output to giberish. Is there > anyway to check if the public_key is the correct key to decrypt that data > before actually decrypting it? That way i can bail out early and say > invalid data file rather than parsing through a bunch of giberish? > > ~Shaun
Feel free to implement this functionality any way that you want. You've specifically opted for the low-level APIs that don't provide this kind of functionality. So if you want it, either use it where it's provided or code it. Note that RSA_public_decrypt is only useful for signatures. Otherwise, you've turned RSA into a symmetric encryption algorithm and have to keep the public key secret. DS ______________________________________________________________________ OpenSSL Project http://www.openssl.org User Support Mailing List openssl-users@openssl.org Automated List Manager [EMAIL PROTECTED]