Unwraps a ciphertext buffer according to the AES Key Wrap algorithm with the given AES parameters and key objects.
#include "huaes.h"
int hu_AESKeyUnwrap(sb_Params aesParams, sb_Key aesKey, size_t ciphertextLength, const unsigned char *ciphertext, size_t *plaintextLength, unsigned char *plaintext, sb_GlobalCtx sbCtx)
BlackBerry 10.0.0
The AES parameters object.
The AES key object.
The length (in bytes) of ciphertext.
The ciphertext buffer.
The length (in bytes) of plaintext.
The plaintext buffer.
A global context.
The AES parameters must have been created with SB_AES_KEYWRAP mode. The length of the ciphertext must be a multiple of SB_AES_KEYWRAP_BLOCK_BYTES and at least 3 * SB_AES_KEYWRAP_BLOCK_BYTES. The length of the plaintext will be SB_AES_KEYWRAP_BLOCK_BYTES bytes shorter than the ciphertext length. The ciphertext and plaintext buffers may overlap in memory subject to the constraints described in the API Reference section on overlapping buffers.
If the length of the plaintext is known, a pointer to a buffer large enough to hold the plaintext should be passed in plaintext and its length in plaintextLength. This function will copy the plaintext value into plaintext and set the actual length of the plaintext in plaintextLength.
If plaintext is NULL, then this function will set the correct length of the plaintext value in plaintextLen. If plaintext is not NULL but plaintextLen is too small, this function will return an error and also will set the correct length of the plaintext value in plaintextLen.
The aesParams object is NULL.
The tag for the params object is not of the expected type.
The aesKey object is NULL.
The aesKey object is invalid.
aesParams uses an invalid mode of operation.
ciphertext is NULL.
ciphertextLength is incorrect.
The plaintextLength pointer is NULL.
plaintextLength is invalid.
Memory allocation failure.
Success.