GenerateDhKeyPair

Generate a DH key pair.

Synopsis

CK_RV GenerateDhKeyPair(
CK_SESSION_HANDLE hSession,
char * txt,
int ftok,
int priv,
int param,
CK_SIZE valueBits,
CK_OBJECT_HANDLE * phPublicKey,
CK_OBJECT_HANDLE * phPrivateKey);
Parameter Description
hSession Open session handle
txt Optional label
ftok 1 for a Token object, 0 for Session object
priv 1 for private object, 0 for public object
param Not used
valueBits Number of prime bits
phPublicKey Reference to object handle to hold created public key
phPrivateKey Reference to object handle to hold created private key

On Successful Return

*phPublicKey — handle to newly created public key

*phPrivateKey — handle to newly created private key

In addition to the Public key attributes set via the parameters, the following are set:

CKA_CLASS CKO_PUBLIC_KEY 
CKA_KEY_TYPE CKK_DH
CKA_VERIFY TRUE
CKA_EXTRACTABLE TRUE

In addition to the Private key attributes set via the parameters, the following are set:

CKA_CLASS CKO_PRIVATE_KEY 
CKA_KEY_TYPE CKK_DH
CKA_SUBJECT_STR “SUBJECT”
CKA_ID 123
CKA_SENSITIVE TRUE
CKA_SIGN TRUE
CKA_EXTRACTABLE TRUE