Chapter 7 Public-Key Operations 291
Performing Elliptic Curve Operations
Step 6: Destroy
Destroy all objects that are no longer needed:
Performing ECDSA with X9.62-Compliant BER
Like the previous section, this section shows how to use Crypto-C to perform ECDSA
in compliance with the ANSI X9.62 Standard. In the previous example, the parameters
were already initialized; in this example, X9.62 compliant BER encodings are used to
initialize the parameters.
The example in this section corresponds to the file x962.c. on the CD-ROM.

Generating EC Parameters

In the section Generating Elliptic Curve Parameters on page 260, we illustrated how
to generate elliptic curve parameters by using AI_ECParamGen. In this example, we
will use the BER encoding of an ANSI X9.62 algorithm identifier, which specifies an
elliptic curve, to set our algorithm object, ecParamsObj. These parameters will
subsequently be used to generate a key pair.
Step 1: Creating an Algorithm Object
You need to create an algorithm object, ecParamsObj, to hold the generated parameter
information.
if ((status = B_VerifyFinal (ecDSAVerify, signature, signatureLen,
(B_ALGORITHM_OBJ)NULL_PTR,
(A_SURRENDER_CTX *)NULL_PTR)) != 0)
break;
T_free(signature);
B_DestroyAlgorithmObject(&ecParamsObj);
B_DestroyAlgorithmObject(&ecDSAVerify);
B_DestroyKeyObject(&publicKey);