Decrypt

nn::crypto::CtrDecryptor::Decrypt Member Function

Syntax

static size_t Decrypt(
     void * pDst,
     size_t dstSize,
     const void * pSrc,
     size_t srcSize,
     const void * pIv,
     size_t ivSize,
     const BlockCipher & c
);

Parameters

Name Description
out pDst Pointer to the buffer storing the decryption results.
in dstSize Size of the buffer pointed to by pDst.
in pSrc Pointer to the buffer storing the ciphertext.
in srcSize Ciphertext size in bytes.
in pIv Pointer to the buffer storing the IV.
in ivSize IV size in bytes.
in c Instance of the block cipher implementation used in decryption.

Return Values

Returns the number of bytes written to pDst.

Description

Handles batch decryption when in CTR mode.

When all data is loaded into memory, you can call this function to decrypt all of the data at once.

For c, specify the same key used in encryption for the block cipher of the same algorithm used in encryption.

Specify a pointer to an IV object in pIv, and its size in ivSize. You must specify the same IV value as the one used for encryption.

The function fails and displays an error if the size of the return value is larger than the buffer size specified in dstSize. Data is not written to the buffer beyond the size specified in dstSize. If the size of the return value is not larger than dstSize, the function indicates a successful completion and writes the size of the return value in pDst.

If this function fails, decryption cannot continue. You must then try again, starting by calling the Initialize function.

Revision History

2011/10/27
Initial version.

CONFIDENTIAL