hu_ECGDSANoHashSign()

Generates a digital signature using the Elliptic Curve German Digital Signature Algorithm (ECGDSA).

Synopsis:

#include "huecc.h"
 
int hu_ECGDSANoHashSign(sb_Params eccParams, sb_PrivateKey privateKey, size_t length, const unsigned char *messageDigest, size_t *sLength, unsigned char *sValue, size_t *rLength, unsigned char *rValue, sb_GlobalCtx sbCtx)

Since:

BlackBerry 10.2.0

Arguments:

eccParams

An ECC parameters object.

privateKey

An ECC private key object.

length

The length (in bytes) of the message digest.

messageDigest

The message digest.

sLength

The length (in bytes) of sValue.

sValue

The 's' component from the signature computation.

rLength

The length (in bytes) of rValue.

rValue

The 'r' component from the signature computation. This is the x-coordinate of the ephemeral public key.

sbCtx

A global context.

Library:

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

Description:

An ECGDSA signature consists of the following two components:

The s value is the result of the signature equation.

The r value is the x co-ordinate of the ephemeral public key.

This function assumes that the input is a message digest (of any length); no digest operation will be performed on the input.

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

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

If sValue is NULL, this function will set the correct length of s in sLength. If sValue is not NULL but sLength is too small, this function will return an error.

Similarly for r.

s and r will always have the same length.

The length of s or r can also be determined by calling hu_ECCParamsGet() and retrieving the OrdLen argument.

Returns:

SB_ERR_NULL_PARAMS

ECC parameters object is NULL.

SB_ERR_BAD_PARAMS

ECC parameters object is invalid.

SB_ERR_NO_RNG

RNG does not exist in the parameters.

SB_ERR_NULL_PRIVATE_KEY

Private key is NULL.

SB_ERR_BAD_PRIVATE_KEY

Private key is invalid.

SB_ERR_BAD_INPUT_BUF_LEN

Message digest length is invalid.

SB_ERR_NULL_INPUT_BUF

Message digest pointer is NULL when the length is positive.

SB_ERR_NULL_S_VALUE_LEN

The s value buffer length pointer is NULL.

SB_ERR_BAD_S_VALUE_LEN

The s value buffer is invalid.

SB_ERR_NULL_R_VALUE_LEN

The r value buffer length pointer is NULL.

SB_ERR_BAD_R_VALUE_LEN

The r value buffer is invalid.

SB_FAIL_ALLOC

Memory allocation failure.

SB_FAILURE

Operation failed.

SB_SUCCESS

Success.

Last modified: 2014-05-14



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

comments powered by Disqus