RSA Security 5.2.2 Projection Television User Manual


 
Performing Elliptic Curve Operations
286 RSA BSAFE Crypto-C Developers Guide
Assume that the steps in Generating an Elliptic Curve Key Pair on page 268 have
been completed and that
publicKey
and
privateKey
are ready to be used.
Computing a Digital Signature
Step 1: Create
Declare a variable to be B_ALGORITHM_OBJ. As defined in the function prototype in
Chapter 4 of the Reference Manual, its address is the argument for
B_CreateAlgorithmObject:
Step 2: Set
The appropriate AI to use is AI_EC_DSAWithDigest. According to the entry in the
Reference Manual, you have to provide a pointer to a
B_DIGEST_SPECIFIER structure to
B_SetAlgorithmInfo:
Currently, the only digest algorithm supported is SHA1. This does not require any
parameters, so specify
NULL_PTR for
digestInfoParams
:
B_KEY_OBJ publicKey = (B_KEY_OBJ)NULL_PTR;
B_KEY_OBJ privateKey = (B_KEY_OBJ)NULL_PTR;
if ((status = GenerateECKeys (&publicKey, &privateKey,
&ecParamsObj, &randomAlgorithm) != 0)
B_ALGORITHM_OBJ ecDSASign = (B_ALGORITHM_OBJ)NULL_PTR;
if ((status = B_CreateAlgorithmObject (&ecDSASign)) != 0)
break;
typedef struct {
B_INFO_TYPE digestInfoType;
POINTER digestInfoParams;
} B_DIGEST_SPECIFIER;