The X9.31 Sample Program
324 RSA BSAFE Crypto-C Developers Guide
/* Step 4: Update */
if ((status = B_VerifyUpdate
(digitalVerifier, (unsigned char *)inputData, inputDataLen,
(A_SURRENDER_CTX *)NULL_PTR)) != 0)
break;
/* Step 5: Final */
generalFlag = 0;
if ((status = B_VerifyFinal
(digitalVerifier, signature, signatureLen,
(B_ALGORITHM_OBJ)NULL_PTR,
&generalSurrenderContext)) != 0)
break;
} while (0);
if (status != 0) {
printf ("Status = %i \n", status);
printf ("Digital Signature failed");
}
else {
printf ("\nDigital Signature verified.");
}
/* Step 6: Destroy */
B_DestroyAlgorithmObject (&randomAlgorithm);
B_DestroyAlgorithmObject (&keypairGenerator);
B_DestroyAlgorithmObject (&digitalSigner);
B_DestroyAlgorithmObject (&digitalVerifier);
B_DestroyKeyObject (&privateKey);
B_DestroyKeyObject (&publicKey);
/* Free up any memory allocated */
T_memset (randomSeed.data, 0, randomSeed.len);
T_free (randomSeed.data);
T_free (randomByteBuffer);
} /* end main */