Performing Elliptic Curve Operations

if ((status = B_CreateKeyObject (&publicKey)) != 0) break;

if ((status = B_CreateKeyObject (&privateKey)) != 0) break;

Step 2: Set

The Reference Manual indicates that the appropriate AI to use for generating an elliptic curve key pair is AI_ECKeyGen. You must set the algorithm object with the parameter information for the elliptic curve that you are using to generate the key. You do this by providing B_SetAlgorithmInfo with a pointer to a B_EC_PARAMS structure.

typedef struct {

B_INFO_TYPE parameterInfoType;

POINTER parameterInfoValue;

} B_EC_PARAMS;

Place the elliptic curve parameters in the A_EC_PARAMS structure ecParamInfo. You can do this either by setting ecParamInfo with the appropriate values, or by following the steps outlined in “Retrieving Elliptic Curve Parameters” on page 264 to retrieve the parameters from an algorithm object and place them into an A_EC_PARAMS structure.

The AI that describes data in this format is AI_ECParameters:

B_EC_PARAMS paramInfo;

paramInfo.parameterInfoType = AI_ECParameters; paramInfo.parameterInfoValue = (POINTER)&ecParamInfo;

if ((status = B_SetAlgorithmInfo (ecKeyGen, AI_ECKeyGen, (POINTER)¶mInfo)) != 0)

break;

You can also optionally use the acceleration table to speed up key generation. See

“Generating Acceleration Tables” on page 273 for more information. Assume that you have the acceleration table corresponding to your elliptic curve in the ITEM structure accelTableItem. The appropriate AI to use with B_SetAlgorithmInfo in this case is AI_ECAcceleratorTable. Pass in a pointer to the ITEM structure holding the acceleration table as the third argument to B_SetAlgorithmInfo. Now set your key- generation algorithm object with the acceleration table information:

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 6 9

Page 291
Image 291
RSA Security 5.2.2 manual Set, Becparams paramInfo