hu_DESParamsCreate()

Creates a DES parameters object.

Synopsis:

#include "hudes.h"
 
int hu_DESParamsCreate(int algorithm, int mode, int parity, int weakKey, sb_RNGCtx rngContext, sb_YieldCtx yieldCtx, sb_Params *desParams, sb_GlobalCtx sbCtx)

Since:

BlackBerry 10.0.0

Arguments:

algorithm

The DES algorithm. The acceptable values are SB_DES_DES, SB_DES_TDES and SB_DES_DESX.

mode

The mode of operation. The acceptable values are SB_DES_ECB, SB_DES_CBC, SB_DES_CFB64 and SB_DES_OFB64. 0 is also acceptable since some adapters support hu_DESBeginV2().

parity

The parity mode. The acceptable values are SB_DES_PARITY_OFF and SB_DES_PARITY_ON.

weakKey

The weak key detection mode. The acceptable values are SB_DES_WEAK_KEY_OFF and SB_DES_WEAK_KEY_ON.

rngContext

An RNG context. (Optional - set to NULL if key generation will not be performed.)

yieldCtx

A yield context. (Optional - set to NULL if yielding is not required.)

desParams

The DES parameters object pointer.

sbCtx

A global context.

Library:

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

Description:

The algorithm, mode of operation, key parity and weak key settings must be specified. An RNG context and/or yielding context must be supplied if key generation and/or yielding will be performed, respectively.

Returns:

SB_ERR_BAD_ALGORITHM

The algorithm type is invalid.

SB_ERR_BAD_MODE

The mode of operation is invalid.

SB_ERR_NULL_PARAMS_PTR

The desParams object pointer is NULL.

SB_FAIL_ALLOC

Memory allocation failure.

SB_SUCCESS

Success.