[Botan-devel] Problem with encrypting and decrypting serialized data

Michał Płoski mludy at wp.pl
Fri May 14 23:19:23 EDT 2010

Hi everyone. I faced the big problem I cant solve for few days.
I have input data unsigned char serializedUdp[] which are serialized. I 
need to encrypt this data ,pass to other function and then decrypt and 
get the same data what in input. After that data should be mapped to 
Problem is that whatever im trying to do serialized data after 
decryption are diffrent than imput.

  SecureVector<byte> Encryption::encrypt(unsigned char 
serializedUdp[],unsigned int length,SymmetricKey 
&keys,InitializationVector &vector)

DataSource_Memory botan_in(serializedUdp,length);
SymmetricKey key(rng, 16);
keys = key;
InitializationVector iv(rng, 16);

Pipe pipe(get_cipher("AES-128/CBC", keys,vector, ENCRYPTION))
return encrypted_raw;

void Encryption::decrypt(SecureVector<byte> encrypted_raw,int length 
,SymmetricKey &klucz,InitializationVector &wektor_inicjujacy)

   Pipe pipe2(get_cipher("AES-128/CBC", klucz, wektor_inicjujacy, 
   SecureVector<byte> decrypted_raw=pipe2.read_all(0);
//And i dont know what do at this moment. Any mapping gives me bad 
value/or error

If anyone have idea how to solve this problem i would be greatfull
Best regards;

More information about the botan-devel mailing list