A SERVICE OF

logo

Performing Elliptic Curve Operations
294 RSA BSAFE Crypto-C Developers Guide
Step 3: Init
Build an algorithm chooser with the appropriate AMs:
Now associate your private key and your algorithm chooser with the algorithm
object:
Step 4: Update
Now, using B_SignUpdate, pass the data to be signed. Note, the data to be signed
must be between 16 and 32 bytes inclusive.
if ((status = B_SetAlgorithmInfo (ecDSASign, AI_EC_DSA,
(POINTER)NULL_PTR)) != 0)
break;
B_ALGORITHM_METHOD *EC_DSA_CHOOSER[] = {
&AM_ECFP_DSA_SIGN,
&AM_ECF2POLY_SA_SIGN,
&AM_ECFP_DSA_VERIFY,
&AM_ECF2POLY_DSA_VERFIY,
(B_ALGORITHM_METHOD *)NULL_PTR
};
if ((status = B_SignInit (ecDSASign, privateKey, EC_DSA_CHOOSER,
(A_SURRENDER_CTX *)NULL_PTR)) != 0)
break;
unsigned char dataToSign[] = {
0x53, 0x69, 0x67, 0x6E, 0x20, 0x74, 0x68, 0x69,
0x73, 0x20, 0x33, 0x32, 0x20, 0x62, 0x79, 0x74,
0x65, 0x20, 0x74, 0x65, 0x73, 0x74, 0x20, 0x6D,
0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x3F, 0x21
};
unsigned int dataToSignLen = sizeof(dataToSign);
if ((status = B_SignUpdate (ecDSASign, dataToSign, dataToSignLen,
(A_SURRENDER_CTX *)NULL_PTR)) != 0)
break;