hu_IDLCKeySet()

Creates an IDLC private and/or public key object from the given key value(s).

Synopsis:

#include "huidlc.h"
 
int hu_IDLCKeySet(sb_Params idlcParams, size_t privateKeyLen, const unsigned char *privateKeyValue, size_t publicKeyLen, const unsigned char *publicKeyValue, sb_PrivateKey *privateKey, sb_PublicKey *publicKey, sb_GlobalCtx sbCtx)

Since:

BlackBerry 10.0.0

Arguments:

idlcParams

IDLC parameters object.

privateKeyLen

The length (in bytes) of the private key value.

privateKeyValue

The private key value.

publicKeyLen

The length (in bytes) of the public key value.

publicKeyValue

The public key value.

privateKey

The private key object pointer.

publicKey

The public key object pointer.

sbCtx

A global context.

Library:

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

Description:

If both private and public key values are supplied, a private key and/or a public key object can be created. The key objects will be created from the corresponding key values.

If only a private key value is supplied, a private key and/or a public key object can be created. The public key will be computed from the private key.

If only a public key value is supplied, only a public key object can be created.

When a public key is supplied, this function attempts to validate it using the specification in Section 5.6.2.4 of NIST SP 800-56A. This operation is applied when the domain parameter q is available in the IDLC parameters object (idlcParams). In such a case, it will cost approximately the same amount of time as computing a DH shared secret. When an IDLC parameters object does not include the q value, this operation will not be applied. The IDLC parameters object will not include the q value, if the parameters object was created by the hu_IDLCParamsCreate() function, or by the hu_IDLCParamsSet() function without supplying the q value.

Returns:

SB_ERR_NULL_PARAMS

The idlcParams object is NULL.

SB_ERR_BAD_PARAMS

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

SB_ERR_NULL_PRI_KEY_BUF

The private key value is NULL.

SB_ERR_BAD_PRI_KEY_BUF_LEN

The private key length is invalid.

SB_ERR_NULL_PUB_KEY_BUF

The public key value is NULL.

SB_ERR_BAD_PUB_KEY_BUF_LEN

The public key length is invalid.

SB_FAIL_INVALID_PRIVATE_KEY

The private key value is invalid.

SB_ERR_BAD_PUBLIC_KEY

The public key is invalid.

SB_FAIL_ALLOC

Memory allocation failure.

SB_SUCCESS

Success.