I write this code, I need to release the resources of the 'new HexEncoder()' or 'new StringSink()' ?

8 views
Skip to first unread message

dgl...@gmail.com

unread,
Jun 25, 2016, 3:14:29 AM6/25/16
to Crypto++ Users
    AES::Encryption aesEncryption((byte *)key, AES::MAX_KEYLENGTH);

    CFB_Mode_ExternalCipher::Encryption cfbEncryption(aesEncryption, iv);

    StreamTransformationFilter cfbEncryptor(cfbEncryption, new HexEncoder(new StringSink(outstr)));
    cfbEncryptor.Put((byte *)plainText, strlen(plainText));
    cfbEncryptor.MessageEnd();

Jeffrey Walton

unread,
Jun 25, 2016, 3:32:28 AM6/25/16
to Crypto++ Users
No, you don't delete it. The StreamTransformationFilter owns it, and the filter will delete it.

Also see http://www.cryptopp.com/wiki/Pipelining and the section on Ownership.

The following might also interest you: http://cryptopp.com/wiki/Init-update-final.

Jeff 
Reply all
Reply to author
Forward
0 new messages