A SERVICE OF

logo

Chapter 7 Public-Key Operations 289
Performing Elliptic Curve Operations
initialized random algorithm in B_SignFinal:
Step 6: Destroy
Destroy all objects that are no longer needed:
Verifying a Digital Signature
To verify the signature, you must go through a similar procedure. At the end, if the
signature is valid,
B_VerifyFinal returns 0. If it is not valid, B_VerifyFinal will
return an error.
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
Use the same AI and
digestInfo
as you did for signing:
unsigned int signatureLen;
if ((status = B_SignFinal (ecDSASign, signature, &signatureLen,
maxSignatureLen, randomAlgorithm,
(A_SURRENDER_CTX *)NULL_PTR)) != 0)
break;
B_DestroyAlgorithmObject(&ecDSASign);
B_DestroyKeyObject(&privateKey);
B_ALGORITHM_OBJ ecDSAVerify = (B_ALGORITHM_OBJ)NULL_PTR;
if ((status = B_CreateAlgorithmObject (&ecDSAVerify)) != 0)
break;
if ((status = B_SetAlgorithmInfo (ecDSAVerify, AI_EC_DSAWithDigest,
(POINTER)&digestInfo)) != 0)
break;