CreateSecretKey

Synopsis

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

Description

Create a secret key object.

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

kt

Key type

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_ID “ID”
CKA_DERIVE TRUE
CKA_EXTRACTABLE TRUE
CKA_UNWRAP TRUE
CKA_WRAP FALSE