RSA Security 5.2.2 manual Create

Models: 5.2.2

1 376
Download 376 pages 13.91 Kb
Page 303
Image 303

Performing Elliptic Curve Operations

To initialize ecParamsObj with a set of parameters describing an elliptic curve, follow the steps in the section “Generating Elliptic Curve Parameters” on page 260. Assume that these steps have been successfully completed and ecParamsObj contains the common parameters for Alice and Bob. Put the elliptic curve parameters in the A_EC_PARAMS structure, ecParams. For an implementation of an application-specific procedure, AllocAndCopyECParamInfo, which retrieves and stores the parameters, see “Retrieving Elliptic Curve Parameters” on page 264:

A_EC_PARAMS ecParams;

A_EC_PARAMS *cryptocECParams;

if ((status = B_GetAlgorithmInfo((POINTER *)&cryptocECParams, alice, AI_ECParameters)) != 0)

break;

if ((status = AllocAndCopyECParamInfo(&ecParams, cryptocECParams)) != 0) break;

You will walk through the steps that Alice goes through, keeping in mind that Bob, perhaps in another application, is performing the same steps.

Note: If this key agreement operation is performed several times with the same parameters, you may wish to use the acceleration table. See “Generating Acceleration Tables” on page 273 for more information.

Step 1: Create

Create the algorithm object which you will use to perform the key agreement:

B_ALGORITHM_OBJ alice = (B_ALGORITHM_OBJ)NULL_PTR;

if ((status = B_CreateAlgorithmObject(&alice)) != 0) break;

Step 2: Set

Set the algorithm object with the information necessary to perform the operation.

AI_EC_DHKeyAgree, when used as the second argument to B_SetAlgorithmInfo, takes as the third argument a pointer to a B_EC_PARAMS structure:

C h a p t e r 7 P u b l i c - K e y O p e r a t i o n s

2 8 1

Page 303
Image 303
RSA Security 5.2.2 manual Create