Performing Elliptic Curve Operations

Step 5: Phase 2

By the time you have reached this step, Alice and Bob have exchanged public values. Assume that the pointer bobPublicValue points to Bob’s public value and bobPublicValueLen gives the length of Bob's public value:

unsigned char *bobPublicValue; unsigned int bobPublicValueLen;

Using Bob’s public value, Alice can compute the secret key that she and Bob will use to communicate with each other:

unsigned char *aliceSecretValue = NULL_PTR; unsigned int aliceSecretValueLen; aliceSecretValue = T_malloc(maxPhase2Len);

if ((status = (aliceSecretValue == NULL_PTR)) != 0) break;

if ((status = B_KeyAgreePhase2(alice, aliceSecretValue, &aliceSecretValueLen, maxPhase2Len, bobPublicValue, bobPublicValueLen, (A_SURRENDER_CTX *)NULL_PTR)) != 0)

break;

Step 6: Destroy

Always destroy key objects and algorithm objects once they are no longer needed:

T_free (alicePublicValue);

T_free (aliceSecretValue);

B_DestroyAlgorithmObject(&randomAlgorithm);

B_DestroyAlgorithmObject(&alice);

Performing ECDSA in Compliance with ANSI X9.62

The Elliptic Curve Digital Signature Agreement (ECDSA) is an elliptic curve analogue of DSA. This section shows how to perform ECDSA in compliance with the ANSI X9.62 Standard, which specifies an implementation of ECDSA.

2 8 4

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 306
Image 306
RSA Security 5.2.2 manual Performing Ecdsa in Compliance with Ansi, If status = aliceSecretValue == Nullptr != 0 break