BuildRsaKeyPair

Create an RSA key pair given the modulus and exponents.

Synopsis

CK_RV BuildRsaKeyPair(
CK_SESSION_HANDLE hSession,
char * txt,
int tok,
int priv,
CK_OBJECT_HANDLE * phPub,
CK_OBJECT_HANDLE * phPri,
char * modulusStr,
char * pubExponentStr,
char * priExponentStr);
Parameter Description
hSession Open session handle
txt Optional label
tok 1 for a Token object, 0 for Session object
priv 1 for Private object, 0 for Public object
phPub Reference to object handle to hold created public key
phPri Reference to object handle to hold created private key
modulusStr Key modulus
pubExponentStr Public key exponent
priExponentStr Private key exponent

On successful return

*phPub — handle to newly created public key

*phPri — 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_RSA 
CKA_VERIFY TRUE 
CKA_SIGN FALSE 
CKA_DECRYPT FALSE 
CKA_ENCRYPT TRUE 
CKA_EXTRACTABLE TRUE 
CKA_WRAP FALSE

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

CKA_CLASS 
CKO_PRIVATE_KEY 
CKA_KEY_TYPE 
CKK_RSA 
CKA_VERIFY FALSE 
CKA_SIGN TRUE 
CKA_DECRYPT TRUE 
CKA_ENCRYPT FALSE 
CKA_EXTRACTABLE TRUE 
CKA_WRAP FALSE