[Botan-devel] Problem with RSA Encryption/decryption

Jack Lloyd lloyd at randombit.net
Tue Jul 5 12:51:22 EDT 2005

On Tue, Jul 05, 2005 at 06:47:42PM +0200, Ruben Quintero Lores wrote:

> I think the current mechanism was source node encrypt the session key
> with the RSA privatekey and destination node decrypt it with the RSA
> publickey of this. It's not correct??

No - for public key encryption you want to encrypt with the public key, decrypt
with the private key. 'Encrypting with the private key' is how you do RSA
signatures (and really they are not the same operation, but people do describe
RSA signatures like that a lot).

Other than swapping your public and private key variables in the code you sent,
it looks fine to me. Just make sure you're actually trying to decrypt the same
value that is returned by the encryption function.


More information about the botan-devel mailing list