RSA Security 5.2.2 manual Initialized random algorithm in BSignFinal, Unsigned int signatureLen

Models: 5.2.2

1 376
Download 376 pages 13.91 Kb
Page 311
Image 311

Performing Elliptic Curve Operations

initialized random algorithm in B_SignFinal:

unsigned int signatureLen;

if ((status = B_SignFinal (ecDSASign, signature, &signatureLen, maxSignatureLen, randomAlgorithm, (A_SURRENDER_CTX *)NULL_PTR)) != 0)

break;

Step 6: Destroy

Destroy all objects that are no longer needed:

B_DestroyAlgorithmObject(&ecDSASign);

B_DestroyKeyObject(&privateKey);

Verifying a Digital Signature

To verify the signature, you must signature is valid, B_VerifyFinal return an error.

go through a similar procedure. At the end, if the returns 0. If it is not valid, B_VerifyFinal will

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:

B_ALGORITHM_OBJ ecDSAVerify = (B_ALGORITHM_OBJ)NULL_PTR;

if ((status = B_CreateAlgorithmObject (&ecDSAVerify)) != 0) break;

Step 2: Set

Use the same AI and digestInfo as you did for signing:

if ((status = B_SetAlgorithmInfo (ecDSAVerify, AI_EC_DSAWithDigest, (POINTER)&digestInfo)) != 0)

break;

C h a p t e r 7 P u b l i c - K e y O p e r a t i o n s

2 8 9

Page 311
Image 311
RSA Security 5.2.2 manual Initialized random algorithm in BSignFinal, Destroy all objects that are no longer needed