The X9.31 Sample Program

/* 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 */

3 2 4

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 346
Image 346
RSA Security 5.2.2 manual If status !=