hu_AESDecrypt()

Decrypts one or more blocks of ciphertext using the given AES context.

Synopsis:

#include "huaes.h"
 
int hu_AESDecrypt(sb_Context aesContext, size_t length, const unsigned char *ciphertext, unsigned char *plaintext, sb_GlobalCtx sbCtx)

Since:

BlackBerry 10.0.0

Arguments:

aesContext

AES context object.

length

The length (in bytes) of ciphertext. For ECB, CBC, and XTS modes of operation the length must be a multiple of SB_AES_128_BLOCK_BYTES. For XTS mode, the data length shall not exceed the data size that Data Unit Sequence Number can represent. The Data Unit Sequence Number is limited to the value that can be expressed in type size_t.

ciphertext

The ciphertext buffer.

plaintext

The plaintext buffer.

sbCtx

A global context.

Library:

libhuapi (For the qcc command, use the -l huapi option to link against this library)

Description:

The plaintext and ciphertext buffers must be the same length, and may overlap in memory subject to the constraints described in the API Reference section on overlapping buffers. This function can be called repeatedly to decrypt more blocks of ciphertext.

Returns:

SB_ERR_BAD_KEY

The key associated with aesContext cannot be used for decryption.

SB_ERR_NULL_CONTEXT

The aesContext object is NULL.

SB_ERR_BAD_CONTEXT

The aesContext object is invalid.

SB_ERR_NULL_INPUT_BUF

The ciphertext buffer is NULL.

SB_ERR_BAD_INPUT_BUF_LEN

length is an invalid ciphertext buffer length.

SB_ERR_NULL_OUTPUT_BUF

The plaintext buffer is NULL.

SB_SUCCESS

Success.