KM_ImportFromScreen

Import a key from console as either encrypted parts OR clear components.

NOTE   This function uses the following callbacks:

>UICB_PromptTokenPin_t

>UICB_ShowMsg_t

Synopsis

#include <kmlib.h>

CK_RV KM_ImportFromScreen ( 
   CK_SESSION_HANDLE   hSession,
   CK_CHAR *           pszLabel,
   CK_KEY_TYPE         keyType,
   CK_SIZE             keySizeInBits,
   CK_ATTRIBUTE *      pTpl,
   CK_COUNT            tplSize,
   CK_COUNT            numComps, 
   CK_OBJECT_HANDLE    hUnwrapKey, 
   CK_BBOOL            isEncMultiPart
);
Parameter Description
hSession Handle to an open session.
pszLabel Label to give to the resulting key.
keyType

The type of the resulting key. Options are:

>CKK_AES

>CKK_CAST128

>CKK_DES

>CKK_DES2

>CKK_DES3

>CKK_IDEA

>CKK_RC2

>CKK_RC4

>CKK_GENERIC_SECRET

keySizeInBits

Size, in bits, of the resulting key. This is not needed for fixed length key types. The size ranges for the supported key types are:

>CKK_AES - 128, 192 or 256 bits

>CKK_CAST128 - 8, 64 or 128 bits

>CKK_DES - 64 bits

>CKK_DES2 - 128 bits

>CKK_DES3 - 192 bits

>CKK_IDEA - 128 bits

>CKK_RC2 - 8 to 1024 bits in 8 bit increments

>CKK_RC4 - 8 to 2048 bits in 8 bit increments

>CKK_GENERIC_SECRET - 8 to "Effectively Infinite" bits

pTpl The attribute template the imported key will have.
tplSize The number of attributes in pTpl.
numComps

The number of XORable components that need to be entered to create the resulting key. This parameter is ignored if hUnwrap is not CK_INVALID_HANDLE.

hUnwrapKey Handle to the unwrapping key to use to decrypt the entered encrypted parts. This parameter should be CK_INVALID_HANDLE if entering XORable components.
isEncMultiPart

Flag indicating if the key is to be imported by more than one encrypted part. The decrypted parts are concatenated to get the final key. This parameter only applies if hUnwrapkey is not CK_INVALID_HANDLE, and the key type is one of:

>CKK_DES2

>CKK_DES3

Returns

CKR_ARGUMENTS_BAD
CKR_ATTRIBUTE_READ_ONLY
CKR_ATTRIBUTE_SENSITIVE
CKR_ATTRIBUTE_TYPE_INVALID
CKR_ATTRIBUTE_VALUE_INVALID
CKR_BUFFER_TOO_SMALL
CKR_CRYPTOKI_NOT_INITIALIZED
CKR_DATA_INVALID
CKR_DEVICE_ERROR
CKR_DEVICE_MEMORY
CKR_DEVICE_REMOVED
CKR_FUNCTION_CANCELED
CKR_FUNCTION_FAILED
CKR_GENERAL_ERROR
CKR_HOST_MEMORY
CKR_KEY_HANDLE_INVALID
CKR_KEY_SIZE_RANGE
CKR_KEY_TYPE_INCONSISTENT
CKR_MECHANISM_INVALID
CKR_MECHANISM_PARAM_INVALID
CKR_OBJECT_HANDLE_INVALID
CKR_OK
CKR_OPERATION_ACTIVE
CKR_RANDOM_NO_RNG
CKR_SESSION_CLOSED
CKR_SESSION_HANDLE_INVALID
CKR_SESSION_READ_ONLY
CKR_SLOT_ID_INVALID
CKR_TEMPLATE_INCOMPLETE
CKR_TEMPLATE_INCONSISTENT
CKR_TOKEN_NOT_PRESENT
CKR_TOKEN_NOT_RECOGNIZED
CKR_TOKEN_WRITE_PROTECTED
CKR_UNWRAPPING_KEY_HANDLE_INVALID
CKR_UNWRAPPING_KEY_SIZE_RANGE
CKR_UNWRAPPING_KEY_TYPE_INCONSISTENT
CKR_USER_NOT_LOGGED_IN
CKR_WRAPPED_KEY_INVALID
CKR_WRAPPED_KEY_LEN_RANGE