RSA Security 5.2.2 manual DataToSign = 0x53, 0x68, 0x73, 0x79, 0x65, 0x20

Models: 5.2.2

1 376
Download 376 pages 13.91 Kb
Page 316
Image 316

Performing Elliptic Curve Operations

if ((status = B_SetAlgorithmInfo (ecDSASign, AI_EC_DSA, (POINTER)NULL_PTR)) != 0)

break;

Step 3: Init

Build an algorithm chooser with the appropriate AMs:

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

};

Now associate your private key and your algorithm chooser with the algorithm object:

if ((status = B_SignInit (ecDSASign, privateKey, EC_DSA_CHOOSER, (A_SURRENDER_CTX *)NULL_PTR)) != 0)

break;

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.

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;

2 9 4

R S A B S A F E C r y p t o - C D e v e l o p e r ’s G u i d e

Page 316
Image 316
RSA Security 5.2.2 manual DataToSign = 0x53, 0x68, 0x73, 0x79, 0x65, 0x20