A SERVICE OF

logo

Performing Elliptic Curve Operations
270 RSA BSAFE Crypto-C Developers Guide
Step 3: Initialize
Here, you can pass a NULL_PTR for the surrender context, because B_GenerateInit is a
speedy function. The Reference Manual entry on
AI_ECKeyGen indicates which
algorithm methods you need to include in your chooser,
keyGenChooser
:
Step 4: Update
There is no Update step for key generation.
Step 5: Generate
Now you can complete the key-generation operation. Note that you must pass in a
properly-initialized random algorithm as the fourth argument:
Step 6: Destroy
Remember to destroy all key objects and algorithm objects once they are no longer
needed:
if ((status = B_SetAlgorithmInfo (ecKeyGen, AI_ECAcceleratorTable,
(POINTER)&accelTableItem)) != 0)
break;
B_ALGORITHM_METHOD *keyGenChooser[] = {
&AM_ECFP_KEY_GEN,
&AM_ECF2POLY_KEY_GEN,
(B_ALGORITHM_METHOD *)NULL_PTR
};
if ((status = B_GenerateInit (ecKeyGen, keyGenChooser,
(A_SURRENDER_CTX *)NULL_PTR)) != 0)
break;
if ((status = B_GenerateKeypair
(ecKeyGen, publicKey, privateKey, randomAlgorithm,
(A_SURRENDER_CTX *)NULL_PTR)) != 0)
break;