KM_ImportP12File

Import a certificate and private key from a PKCS #12 file.

NOTE   This function uses the following callbacks:

>UICB_PromptTokenPin_t

>UICB_ShowMsg_t

Synopsis

#include <kmlib.h>

CK_RV KM_ImportP12File ( 
   CK_SESSION_HANDLE   hSession, 
   CK_CHAR *           pszFileName,
   CK_ATTRIBUTE *      pPrivateKeyTpl, 
   CK_COUNT            privateKeyTplSize,
   CK_ATTRIBUTE *      pCertTpl,
   CK_COUNT            certTplSize, 
   CK_OBJECT_HANDLE *  phPrivateKey, 
   CK_OBJECT_HANDLE *  phCert
);
Parameter Description
hSession Handle to an open session.
pszFileName Fully qualified name of the file to import from.
pPrivateKeyTpl The attribute template the private key will have. Must have all boolean attributes that need to be TRUE, as well as the label. No other attributes are required.
privateKeyTplSize The number of attributes in pPrivateKeyTpl.
pCertTpl The attribute template the certificate will have. Must have all boolean attributes that need to be TRUE, as well as the label. No other attributes are required.
certTplSize The number of attributes in pCertTpl.
phPrivateKey Location to hold the handle of the resulting private key.
phCert Location to store the handle of the resulting certificate.

Returns

CKR_ARGUMENTS_BAD
CKR_ATTRIBUTE_READ_ONLY 
CKR_ATTRIBUTE_TYPE_INVALID
CKR_ATTRIBUTE_VALUE_INVALID 
CKR_BUFFER_TOO_SMALL
CKR_CRYPTOKI_NOT_INITIALIZED
CKR_DATA_LEN_RANGE
CKR_DEVICE_ERROR
CKR_DEVICE_MEMORY
CKR_DEVICE_REMOVED 
CKR_ENCRYPTED_DATA_INVALID
CKR_ENCRYPTED_DATA_LEN_RANGE 
CKR_FUNCTION_CANCELED
CKR_FUNCTION_FAILED
CKR_GENERAL_ERROR
CKR_HOST_MEMORY 
CKR_KEY_FUNCTION_NOT_PERMITTED
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_OPERATION_NOT_INITIALIZED
CKR_SESSION_CLOSED
CKR_SESSION_HANDLE_INVALID
CKR_SESSION_READ_ONLY
CKR_SIGNATURE_INVALID
CKR_SIGNATURE_LEN_RANGE
CKR_TEMPLATE_INCOMPLETE
CKR_TEMPLATE_INCONSISTENT
CKR_TOKEN_WRITE_PROTECTED
CKR_USER_NOT_LOGGED_IN