GenerateRsaKeyPair
Generate an RSA key pair.
Synopsis
CK_RV GenerateRsaKeyPair(
CK_SESSION_HANDLE hSession,
char * txt,
int ftok,
int priv,
CK_SIZE modulusBits,
int expType,
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 |
modulusBits | Size of modulus to generate |
expType | 0 for random exponent, 1 for Fermat 4 exponent (\x00010001), 2 for smallest valid exponent (3) |
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_RSA
CKA_SUBJECT_STR “SUBJECT”
CKA_ENCRYPT TRUE
CKA_VERIFY TRUE
CKA_WRAP FALSE
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_RSA CKA_SUBJECT_STR “SUBJECT” CKA_ID 123 CKA_SENSITIVE TRUE CKA_DECRYPT TRUE CKA_SIGN TRUE CKA_UNWRAP FALSE CKA_EXTRACTABLE TRUE