CreateDesKey

Synopsis

CK_RV CreateDesKey(
CK_SESSION_HANDLE hSession,
char * txt,
int tok,
int priv,
CK_BYTE * keyValue,
int len,
CK_OBJECT_HANDLE * phKey);

Description

Create a secret key object, and set the key type to CKK_DES, CKK_DES2or CKK_DES3 (based on len).

Parameters

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

keyValue

Key value

len

Length of key value

phKey

Reference to object handle to hold created key

On successful return

*phKey— handle to newly created key

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

CKA_CLASS CKO_SECRET_KEY 
CKA_KEY_TYE CKK_DES, CKK_DES2 OR CKK_DES3
CKA_ID “ID”
CKA_DERIVE TRUE
CKA_EXTRACTABLE TRUE
CKA_UNWRAP TRUE
CKA_WRAP FALSE