hu_DESDecryptMsg()

Decrypts a ciphertext buffer using the given DES parameters and key.

Synopsis:

#include "hudes.h"
 
int hu_DESDecryptMsg(sb_Params desParams, sb_Key desKey, size_t ivLen, const unsigned char *iv, size_t length, const unsigned char *ciphertext, unsigned char *plaintext, sb_GlobalCtx sbCtx)

Since:

BlackBerry 10.0.0

Arguments:

desParams

A DES parameters object.

desKey

A DES key object.

ivLen

The length (in bytes) of initial vector. The only acceptable value is SB_DES_IV_SIZE.

iv

The initial vector.

length

The length (in bytes) of ciphertext. The acceptable values are multiples of SB_DES_BLOCK_SIZE.

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:

For the SB_DES_CBC, SB_DES_CFB64 and SB_DES_OFB64 modes of operation, an initial vector is required. iv is ignored for SB_DES_ECB, as an initial vector is not required for that mode. 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.

Note: This function should only be called for blocks of plaintext and ciphertext that can be stored entirely in memory.

Returns:

SB_ERR_NULL_PARAMS

The deskParams object is NULL.

SB_ERR_BAD_PARAMS

The tag for the params object is not of the expected type.

SB_ERR_NULL_KEY

The desKey object is NULL.

SB_ERR_BAD_KEY

The desKey object is invalid.

SB_ERR_NULL_IV

The initial vector, iv, is NULL.

SB_ERR_BAD_IV_LEN

The length of the initial vector, ivLen, is invalid.

SB_ERR_NULL_INPUT_BUF

The ciphertext buffer is NULL.

SB_ERR_BAD_INPUT_BUF_LEN

The length of the ciphertext buffer is invalid.

SB_ERR_NULL_OUTPUT_BUF

The plaintext buffer is NULL.

SB_SUCCESS

Success.