RSA Security 5.2.2 manual Final, Data and you know its length, your call is the following

Models: 5.2.2

1 376
Download 376 pages 13.91 Kb
Page 270
Image 270

Performing DSA Operations

data and you know its length, your call is the following:

if ((status = B_VerifyUpdate (dsaVerifier, inputData, inputDataLen, (A_SURRENDER_CTX *)NULL_PTR)) != 0)

break;

Step 5: Final

B_VerifyUpdate digested the data. Check the signature with B_VerifyFinal. The Reference Manual Chapter 2 entry on AI_DSAWithSHA1 states:

You must pass a random algorithm in B_SignFinal, but may pass (B_ALGORITHM_OBJ)NULL_PTR for all other randomAlgorithm arguments.

This function does not return immediately, so use a surrender context:

/* generalFlag is for the surrender function. */ generalFlag = 0;

if ((status = B_VerifyFinal (dsaVerifier, signature, signatureLen, (B_ALGORITHM_OBJ)NULL_PTR, &generalSurrenderContext)) != 0)

break;

The return value will be zero if the signature verifies, nonzero if it does not. Of course, a nonzero return value may indicate some other error, so check any error return against the Crypto-C Error Types, Appendix A of the Reference Manual.

Step 6: Destroy

When you are done with all objects, remember to destroy them:

B_DestroyAlgorithmObject (&dsaVerifier);

B_DestroyKeyObject (&dsaPublicKey);

2 4 8

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 270
Image 270
RSA Security 5.2.2 manual Final, Data and you know its length, your call is the following