Performing Elliptic Curve Operations

Using Elliptic Curve Parameters

See the section “Generating Elliptic Curve Parameters” on page 260 for the steps you must complete to generate a new curve. You need a properly initialized pseudo- random number generator. Assume that the function InitializeRandomAlgorithm goes through Steps 1 through 4 in the section “Generating Random Numbers” on page 165. Also assume that the function InitializeECParamsObj generates new parameters and places them in ecParamsObj, following the steps in “Using Elliptic Curve Parameters” on page 298:

B_ALGORITHM_OBJ randomAlgorithm = (B_ALGORITHM_OBJ)NULL_PTR; B_ALGORITHM_OBJ ecParamsObj = (B_ALGORITHM_OBJ)NULL_PTR;

if ((status = InitializeRandomAlgorithm (&randomAlgorithm)) != 0) break;

if ((status = InitializeECParamsObj (&ecParamsObj, &randomAlgorithm)) != 0)

break;

You now have a properly initialized random algorithm object, randomAlgorithm, and an algorithm object, ecParamsObj, containing the parameters that describe the elliptic curve that you will use.

Using an EC Key Pair

Before you can encrypt, you need to generate a public/private key pair. As described in “Using an EC Key Pair” on page 298, key generation requires a properly initialized random algorithm and the parameters describing an elliptic curve, both of which you have created in the previous step:

B_KEY_OBJ publicKey = (B_KEY_OBJ)NULL_PTR;

B_KEY_OBJ privateKey = (B_KEY_OBJ)NULL_PTR;

Assume that the steps in “Using an EC Key Pair” have been completed and that publicKey and privateKey are ready to be used.

ECAES Public-Key Encryption

Once you have gone through the preliminary steps of generating your elliptic curve parameters and creating your public/private key pair, you are ready to encrypt your message.

2 9 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 320
Image 320
RSA Security 5.2.2 manual Using Elliptic Curve Parameters, Using an EC Key Pair, Ecaes Public-Key Encryption