KM_ExportToken

Export a token for a specific device.

Synopsis

#include <kmlib.h>

CK_RV KM_ExportToken ( 
   CK_SESSION_HANDLE   hSession,
   CK_CHAR             serialNumber[CK_SERIAL_NUMBER_SIZE],
   CK_BYTE *           tokenData,
   CK_ULONG *          pTokenDataSize
);
Parameter Description
hSession Handle to a USER logged in session on the token to be exported.
serialNumber The serial number of the destination device for which the token is being exported.
tokenData Location to store the exported token data. If NULL is specified no data will be exported, however pTokenDataSize will still return the size of exported token data.
pTokenDataSize The size of the tokenData buffer. Upon completion of the function, this parameter will contain the size of the exported data. If pTokenDataSize is too small, no data will be placed in tokenData.

Returns

CKR_ARGUMENTS_BAD
CKR_BUFFER_TOO_SMALL
CKR_CRYPTOKI_NOT_INITIALIZED
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_NOT_WRAPPABLE
CKR_KEY_SIZE_RANGE
CKR_KEY_UNEXTRACTABLE
CKR_MECHANISM_INVALID
CKR_MECHANISM_PARAM_INVALID
CKR_OK
CKR_OPERATION_ACTIVE
CKR_SESSION_CLOSED
CKR_SESSION_HANDLE_INVALID
CKR_USER_NOT_LOGGED_IN
CKR_WRAPPING_KEY_HANDLE_INVALID
CKR_WRAPPING_KEY_SIZE_RANGE
CKR_WRAPPING_KEY_TYPE_INCONSISTENT