[Botan-devel] PK_Decryptor_MR_with_EME: Input is invalid

z3ky z3ky at gmx.de
Tue Dec 4 16:21:49 EST 2007


Hi
according to the tutorial on the botan webside i tried to encrypt and
decrypt a simple word.
but i always get this exception:

what():  Botan: PK_Decryptor_MR_with_EME: Input is invalid

i think the word is not correctly encrypted but i don' find the failure.

i hope somone can help me.

regerds
z3ky

> #include <iostream>
> #include <string>
>
> #include <botan/botan.h>
> #include <botan/look_pk.h>
> #include <botan/rsa.h>
>
> using namespace Botan;
> using namespace std;
>
> int main(void)
> {
>     //Initialisierung von Botan
>     LibraryInitializer init;
>     
>     //Create a rse private and public Keys
>     
>     RSA_PrivateKey* priv_rsa = new RSA_PrivateKey(1024);
>     RSA_PublicKey* pub_rsa = new RSA_PublicKey(*priv_rsa);
>     
>     PK_Encrypting_Key* enc_key =
> dynamic_cast<PK_Encrypting_Key*>(pub_rsa);
>     PK_Encryptor* enc = get_pk_encryptor(*enc_key, "EME1(SHA-1)");
>     
>     byte msg[] = {"test"};
>     
>     SecureVector<byte> ciphertext= enc->encrypt(msg, sizeof(msg));
>     
>     
>     PK_Decrypting_Key* dec_key =
> dynamic_cast<PK_Decrypting_Key*>(priv_rsa);
>     PK_Decryptor* dec = get_pk_decryptor(*dec_key, "EME1(SHA-1)");
>     
>     SecureVector<byte> plaintext = dec->decrypt(ciphertext,
> sizeof(ciphertext));
>
>     return 0;
> }




More information about the botan-devel mailing list