Aes multipart encryption or decryption

Aes multipart encryption or decryption

BY 05 Nov 2013 Native Application Development

Hi all,
can anybody help me in implementing aes multipart encryption /decryption ,please guide me in using the following api’s

i had followed the below sequence

//for encryption
 

    AesCipher *aescipher = new AesCipher();
    aescipher->Construct(“ECB/128/PKCS7PADDING”,CIPHER_ENCRYPT);
    SecretKeyGenerator *keygen=new SecretKeyGenerator();
    ISecureRandom *prandno=new AesSecureRandom();
    ByteBuffer *randno1=prandno->GenerateRandomBytesN(16);
    keygen->Construct(*pwdhash);
    ISecretKey *key=(ISecretKey*)keygen->GenerateKeyN();
    aescipher->SetKey(*key);
    aescipher->Initialize();
    ByteBuffer *output = aescipher->UpdateN(*randno1);
    aescipher->FinalizeN();

//for decryption

    AesCipher *aescipher = new AesCipher();
    aescipher->Construct(“ECB/128/PKCS7PADDING”,CIPHER_DECRYPT);
    SecretKeyGenerator *keygen=new SecretKeyGenerator();
    keygen->Construct(*pwdhash);
    ISecretKey *key=(ISecretKey*)keygen->GenerateKeyN();
    aescipher->SetKey(*key);
    aescipher->Initialize();
    ByteBuffer *input = StringUtil::StringToUtf8N(encrypted data);
    ByteBuffer *output = aescipher->UpdateN(*input);
    aescipher->FinalizeN();

while decrypting i am getting E_System unexecpted error
 please help me 

 

Written by