hu_ECMQVRawSharedGen()

Generates a shared secret that is the output of an ECMQV key agreement.

Synopsis:

#include "huecc.h"
 
int hu_ECMQVRawSharedGen(sb_Params eccParams, sb_PrivateKey privateKey, sb_PrivateKey ephemPrivateKey, sb_PublicKey ephemPublicKey, sb_PublicKey remotePublicKey, sb_PublicKey remoteEphemPublicKey, size_t *secretLen, unsigned char *sharedSecret, sb_GlobalCtx sbCtx)

Since:

BlackBerry 10.0.0

Arguments:

eccParams

An ECC parameters object.

privateKey

An ECC private key object.

ephemPrivateKey

An ECC private key object.

ephemPublicKey

An ECC public key object.

remotePublicKey

An ECC public key object.

remoteEphemPublicKey

An ECC public key object.

secretLen

The length (in bytes) of the shared secret.

sharedSecret

The shared secret value.

sbCtx

A global context.

Library:

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

Description:

If the length of the shared secret is known, a pointer to a buffer large enough to hold the shared secret should be passed in sharedSecret and its length in secretLen. This function will copy the shared secret into sharedSecret and set the actual length of the shared secret in secretLen.

If sharedSecret is NULL, this function will set the correct length of the shared secret in secretLen. If sharedSecret is not NULL but secretLen is too small, this function will return an error.

The length of the shared secret can also be determined by calling hu_ECCParamsGet() and retrieving the reducLen argument.

Returns:

SB_ERR_NULL_PARAMS

The eccParams object is NULL.

SB_ERR_BAD_PARAMS

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

SB_ERR_NULL_PRIVATE_KEY

The privateKey object NULL.

SB_ERR_BAD_PRIVATE_KEY

The privateKey object invalid.

SB_ERR_NULL_EPHEM_PRI_KEY

The ephemeral private key object is NULL.

SB_ERR_BAD_EPHEM_PRI_KEY

The ephemeral private key object is invalid.

SB_ERR_NULL_EPHEM_PUB_KEY

The ephemeral public key is NULL.

SB_ERR_BAD_EPHEM_PUB_KEY

The ephemeral public key is invalid.

SB_ERR_NULL_REM_PUB_KEY

The remote public key is NULL.

SB_ERR_BAD_REM_PUB_KEY

The remote public key is invalid.

SB_ERR_NULL_REM_EPHEM_PUB_KEY

The remote ephemeral public key is NULL.

SB_ERR_BAD_REM_EPHEM_PUB_KEY

The remote ephemeral public key is invalid.

SB_ERR_NULL_OUTPUT_BUF_LEN

The shared secret buffer length is NULL.

SB_ERR_BAD_OUTPUT_BUF_LEN

The shared secret length is invalid.

SB_FAIL_ALLOC

Memory allocation failure.

SB_SUCCESS

Success.