[Botan-devel] Problem with RSA Encryption/decryption

Ruben Quintero Lores rubenql at iti.upv.es
Tue Jul 5 12:02:26 EDT 2005


I have the following code to encrypt/desencrypt the hash of a Diffie
Hellmann session symetric key, I use to encrypt a private RSA key and a
public RSA key to desencrypt

byte* modify(bool encryption, RSA_PrivateKey *aprivatekey, RSA_PublicKey
    if (encryption)  // encryption
     PK_Encryptor* rsa_enc = get_pk_encryptor(*aprivatekey, "EME1
     SecureVector<byte> cipher = rsa_enc->encrypt(sessionkey.bits_of(),
     delete rsa_enc;
     return (byte*)cipher;
  else  //decryption
     PK_Decryptor* rsa_dec = get_pk_decryptor(*apublickey, "EME1
     SecureVector<byte> cipher = rsa_dec->decrypt(sessionkey.bits_of(),
     delete rsa_dec;
     return (byte*)cipher;

The encryption process apparently work fine BUT in desencryption process
I get an error like this

terminate called after throwing an instance of 'Botan::Exception'
  what():  Botan: PK_Decryptor_MR_with_EME: Input is invalid

What happend?? Wich is the meaning of this error?? What I'll doing

Help me please because I don't understand.

Thank you,

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.randombit.net/pipermail/botan-devel/attachments/20050705/8070b007/attachment.html>

More information about the botan-devel mailing list