hu_DESKeyGen()

Creates an DES key object of the specified length from random data that can later be used for encryption and/or decryption.

Synopsis:

#include "hudes.h"
 
int hu_DESKeyGen(sb_Params desParams, sb_Key *desKey, sb_GlobalCtx sbCtx)

Since:

BlackBerry 10.0.0

Arguments:

desParams

A DES parameters object.

desKey

The DES key object pointer.

sbCtx

A global context.

Library:

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

Description:

The DES parameter object must have been created with an RNG context.

If the parity mode is SB_DES_PARITY_ON, the encryption keys will be generated with odd parity.

If the weak key mode is SB_DES_WEAK_KEY_ON, the encryption keys will be generated such that they will not match a known weak key.

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_PTR

The desKey object pointer is NULL.

SB_FAIL_ALLOC

Memory allocation failure.

SB_SUCCESS

Success.