hu_DESBegin()

Creates an DES context initialized with the given parameters and key that can later be used for encryption and/or decryption.

Synopsis:

#include "hudes.h"
 
int hu_DESBegin(sb_Params desParams, sb_Key desKey, size_t ivLen, const unsigned char *iv, sb_Context *desContext, 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.

desContext

The DES context object pointer.

sbCtx

A global context.

Library:

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

Description:

An initial vector, iv, is required for the SB_DES_CBC, SB_DES_CFB64 and SB_DES_OFB64 modes of operation. iv is ignored for SB_DES_ECB, as an initial vector is not required for that mode.

Returns:

SB_ERR_NULL_PARAMS

The desParams 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 key object is NULL.

SB_ERR_BAD_KEY

The desKey key object is invalid.

SB_ERR_NULL_IV

The initial vector, iv, is NULL.

SB_ERR_BAD_IV_LEN

The initial vector length, ivLen, is invalid.

SB_ERR_NULL_CONTEXT_PTR

The sbCtx object pointer is NULL.

SB_ERR_NO_MODE

No mode has been specified.

SB_FAIL_ALLOC

Memory allocation failure.

SB_SUCCESS

Success.