hu_ECSPEKEKeyGen()

Creates an ECC private and/or public key object from the given password.

Synopsis:

#include "huecspeke.h"
 
int hu_ECSPEKEKeyGen(sb_Params eccParams, int hashAlgId, size_t oLen, size_t passwordBytes, const unsigned char *passwordValue, sb_PublicKey *genFromPasswd, sb_PrivateKey *privateKey, sb_PublicKey *publicKey, sb_GlobalCtx sbCtx)

Arguments:

eccParams

An ECC parameters object.

hashAlgId

The hash algorithm for HashRE. Currently only HU_MGF1_SHA256 is supported.

oLen

The length (in bytes) of the output of HashRE. Currently only HU_HASHRE_O_LEN is supported.

passwordBytes

The length (in bytes) of the password.

passwordValue

The password value.

genFromPasswd

The generator point produced from the password.

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:

This function performs ephemeral key pair generation using the ECBPKAS-SPEKE algorithm as specified in IEEE 1363.2-2008.

IEEE 1363.2-2008 contains some errors; this implementation corrects those errors.

The function applies the ECREDP-1 primitive to the password to derive a generator point. It then generates a key pair on the subgroup formed by this generator point.

In order to use this function, you must first register the underlying ECC and hash algorithms. You also need to explicitly register the hu_ZModCalcExpo() function.

Currently only the secp521r1 curve is supported.

Also, currently, for HashRE, only MGF-1-SHA-256 with an oLen of 96 bytes (768 bits) is supported.

The generator point produced from the password is used for key confirmation and must therefore be treated as a secret as sensitive as the password.

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_NOT_SUPPORTED

The specified elliptic curve or hash algorithm is not supported.

SB_ERR_BAD_LENGTH

The specified size for oLen is not supported.

SB_ERR_BAD_INPUT_LEN

The length of password is zero.

SB_ERR_NULL_INPUT

The passwordValue is NULL.

SB_ERR_NULL_OUTPUT

The genFromPasswd parameter is NULL.

SB_ERR_NULL_PRIVATE_KEY

The privateKey parameter is NULL.

SB_ERR_NULL_PUBLIC_KEY

The publicKey parameter is NULL.

SB_FAIL_ALLOC

Memory allocation failure.

SB_SUCCESS

Success.

Last modified: 2014-05-14



Got questions about leaving a comment? Get answers from our Disqus FAQ.

comments powered by Disqus