![](https://pdfstore-manualsonline.prod.a.ki/pdfasset/9/c4/9c4432ed-94b6-4f82-9d47-c9fb5f98b613/9c4432ed-94b6-4f82-9d47-c9fb5f98b613-bg10c.png)
Performing DSA Operations
246 RSA BSAFE Crypto-C Developer’s Guide
page 118:
Step 6: Destroy
When you are done with all objects, remember to destroy them:
Verifying a Digital Signature
The Crypto-C sequence B_VerifyInit, B_VerifyUpdate, and B_VerifyFinal digests
the original data and checks the signature. If the signature is valid,
B_VerifyFinal
returns a zero; if the signature is not valid, it returns an error code.
Step 1: Creating An Algorithm Object
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:
#define MAX_SIG_LEN 48
unsigned char signature[MAX_SIG_LEN];
unsigned int signatureLen;
/* generalFlag is for the surrender function. */
generalFlag = 0;
if ((status = B_SignFinal
(dsaSigner, signature, &signatureLen, MAX_SIG_LEN,
randomAlgorithm,
&generalSurrenderContext)) != 0)
break;
B_DestroyAlgorithmObject (&dsaSigner);
B_DestroyKeyObject (&dsaPrivateKey);
B_ALGORITHM_OBJ dsaVerifier = (B_ALGORITHM_OBJ)NULL_PTR;
if ((status = B_CreateAlgorithmObject (&dsaVerifier)) != 0)
break;