AI_DHKeyAgreeBER

AI_DHKeyAgree

AI_DHKeyAgree

Purpose:

This AI allows you to perform Diffie-Hellman key agreement. You may have generated system parameters (for example, through AI_DHParamGen), or you may have retrieved them from another source. These system parameters are passed to B_SetAlgorithmInfo. The function B_KeyAgreePhase1 creates the public value that is sent to the other party, and B_KeyAgreePhase2 processes the value from the other

party to produce the shared secret value. Seefor the same algorithm type with BER encoding.

Type of information this allows you to use:

Diffie-Hellman system parameters, where the prime and base integers, and the exponent size, are specified for performing Diffie-Hellman key agreement as defined in PKCS #3.

Format of info supplied to B_SetAlgorithmInfo:

pointer to an A_DH_KEY_AGREE_PARAMS structure:

typedef struct

{

 

 

ITEM

prime;

/* prime modulus

*/

ITEM

base;

/* base generator

*/

unsigned int

exponentBits;

/* size of random exponent in bits */

}A_DH_KEY_AGREE_PARAMS;

Each ITEM supplies an integer in canonical format, where the ITEM’s data points to an unsigned byte array -- most significant byte first -- and the ITEM’s len gives its length. All leading zeros are stripped from each integer before it is copied to the algorithm object.

Format of info returned by B_GetAlgorithmInfo:

pointer to an A_DH_KEY_AGREE_PARAMS structure (see above). All leading zeros have been stripped from each integer in the structure.

C h a p t e r 2 A l g o r i t h m I n f o Ty p e s

45

Page 55
Image 55
RSA Security 5 manual AIDHKeyAgree, Pointer to an Adhkeyagreeparams structure