?? auxiliary.h
字號:
/*
[]======================================================================[]
Copyright(C) 2000-2004, Feitian Technologies Co., Ltd.
All rights reserved.
FILE:
auxiliary.cpp
DESC:
this file will include the auxiliary functions such as:
token label modification function,
container query function,
NOTE:
you should include "cryptoki.h" before include this header file
REVISION:
2004-04-02 [Skybird Le]
Created.
2005-03-11 [Apex Liu]
Add function EP_InitToken().
[]======================================================================[]
*/
#ifndef __AUXILIARY_H__
#define __AUXILIARY_H__
//#include <pkcs11/notifymsg.h>
#ifdef __cplusplus
extern "C" {
#endif
typedef struct AUX_INIT_TOKEN_PRIVATE
{
// Init Type
CK_BYTE InitType; // 0:format card only; 1:Set ATR; 3: Create PKI App
// Pointer to a buffer that specifies the name of the token. If it is
// NULL, means use default token name "ePass Token". Max to 31 bytes.
CK_BYTE_PTR pucTokenName;
CK_ULONG ulTokenNameLen;
// The max retry counter of SO-PIN. Can be 1 to 15. Any value out of this
// range will case use 5 instead.
CK_BYTE ucMaxSoPinCounter;
// The max retry counter of User-PIN. Can be 1 to 15. Any value out of this
// range will case use 5 instead.
CK_BYTE ucMaxUserPinCounter;
// Pointer to a buffer that specifies the SO-PIN after initialize. If it
// is NULL, use the default value: "rockey".
CK_BYTE_PTR pucSoPin;
// Length of the pucSoPin.
CK_ULONG ulSoPinLen;
// Pointer to a buffer that specifies the User-PIN after initialize. If
// it is NULL, use the default value: "1234".
CK_BYTE_PTR pucUserPin;
// Length of the pucUserPin.
CK_ULONG ulUserPinLen;
// Size of the public data storage. This parameter has no default value.
CK_ULONG ulPublicSize;
// Size of the private data storage. This parameter has no default value.
CK_ULONG ulPrivateSize;
// ATR to OEM
CK_BYTE_PTR pOEM_ATR;
CK_ULONG ulOEMATRLen;
// Extra data.
CK_ULONG ulExtData;
}AUX_INIT_TOKEN_PRIVATE;
typedef AUX_INIT_TOKEN_PRIVATE CK_PTR AUX_INIT_TOKEN_PRIVATE_PTR;
// Low level initialize the token
typedef
CK_DECLARE_FUNCTION_POINTER(CK_RV, EP_InitTokenPrivate)
(
CK_SLOT_ID slotID, // ID of the token's slot
AUX_INIT_TOKEN_PRIVATE_PTR pInitParam
);
// set the token name (label)
// rule:
// 1. if (pPin == NULL or ulPinLen == 0), user must have login
// 2. userType != CKU_SO && userType != CKU_USER, user must have login
typedef
CK_DECLARE_FUNCTION_POINTER(CK_RV, EP_SetTokenLabel)
(
CK_SLOT_ID slotID, // ID of the token's slot
CK_USER_TYPE userType, // the user type
CK_CHAR_PTR pPin, // the user pin
CK_ULONG ulPinLen, // length in bytes of the PIN
CK_CHAR_PTR pLabel // 32-byte token label (blank padded)
);
// get the containers associated with the slot
// this function can return output in a variable-length buffer
typedef
CK_DECLARE_FUNCTION_POINTER(CK_RV, EP_GetContainerList)
(
CK_SLOT_ID slotID, // ID of the token's slot
CK_CHAR_PTR mszContainers, // multi-string that list the containers associated with the slot
CK_ULONG_PTR pulSize // sizeof mszContainers by CHAR
);
// create a new container with the specific name
typedef
CK_DECLARE_FUNCTION_POINTER(CK_RV, EP_NewContainer)
(
CK_SLOT_ID slotID, // ID of the token's slot
CK_CHAR_PTR mszContainer // multi-string that list the containers associated with the slot
);
// delete a container with the specific name
typedef
CK_DECLARE_FUNCTION_POINTER(CK_RV, EP_DeleteContainer)
(
CK_SLOT_ID slotID, // ID of the token's slot
CK_CHAR_PTR mszContainer // multi-string that list the containers associated with the slot
);
struct AUX_PIN_INFO
{
CK_BYTE bSOPinMaxRetries;
CK_BYTE bSOPinCurCounter;
CK_BYTE bUserPinMaxRetries;
CK_BYTE bUserPinCurCounter;
CK_FLAGS pinflags;
};
typedef AUX_PIN_INFO CK_PTR AUX_PIN_INFO_PTR;
typedef
CK_DECLARE_FUNCTION_POINTER(CK_RV, EP_GetPinInfo)
(
CK_SLOT_ID slotID, // (IN) ID of the token's slot
AUX_PIN_INFO_PTR pPinInfo // (OUT) pin info of this token
);
typedef
CK_DECLARE_FUNCTION_POINTER(CK_RV, EP_GetTokenID)
(
CK_SLOT_ID slotID, // (IN) ID of the token's slot
CK_BYTE_PTR pbTokenID, // (OUT) such as ATR
CK_ULONG_PTR pulTokenIDLen, // (IN, OUT) token id's length
CK_BYTE_PTR pbOriginalTokenID, // (OUT) such as Original ATR
CK_ULONG_PTR pulOriginalIDLen // (IN, OUT) Original token id's length
);
typedef
CK_DECLARE_FUNCTION_POINTER(CK_RV, EP_DirectCmd)
(
CK_SLOT_ID slotID, // (IN) ID of the token's slot
CK_BYTE_PTR pbCmdData, // (IN) Command data to send to tsp
CK_ULONG ulCmdDataLen, // (IN) Command data len
CK_BYTE_PTR pbRespData, // (OUT) Response data to get
CK_ULONG_PTR pulRespDataLen // (IN, OUT)Response data length
);
typedef
CK_DECLARE_FUNCTION_POINTER(CK_RV, EP_SendExtCmd)
(
CK_SLOT_ID slotID, // (IN) ID of the token's slot
CK_ULONG ulCmdType, // (IN) Command type to send to tsp
CK_BYTE_PTR pbCmdData, // (IN) Command data to send to tsp
CK_ULONG ulCmdDataLen, // (IN) Command data len
CK_BYTE_PTR pbRespData, // (OUT) Response data to get
CK_ULONG_PTR pulRespDataLen // (IN, OUT)Response data length
);
//typedef
//CK_DECLARE_FUNCTION_POINTER(CK_RV, EP_SetNotifyCallBack)
//(
// EP_NotifyCallBack pCallBackFunc // (IN) call back function
//);
#define EP_SEND_DIRECT_CMD 0
#define EP_SEND_EXT_CMD 1
#define EP_SET_TOKEN_LABEL 2
#define EP_INIT_TOKEN_PRIVATE 3
#define EP_GET_CONTAINER_LIST 4
#define EP_NEW_CONTAINER 5
#define EP_DELETE_CONTAINER 6
#define EP_GET_PIN_INFO 7
#define EP_GET_TOKEN_ID 8
#define EP_SET_NOTIFY_CALL_BACK 9
#define EP_FUNC_MAX_COUNT 20
struct AUX_FUNC_LIST
{
CK_VERSION version; /* Auxiliary Version */
CK_ULONG ulFuncCount;
void* pFunc[EP_FUNC_MAX_COUNT];
};
typedef AUX_FUNC_LIST CK_PTR AUX_FUNC_LIST_PTR;
typedef AUX_FUNC_LIST_PTR CK_PTR AUX_FUNC_LIST_PTR_PTR;
CK_DECLARE_FUNCTION(CK_RV, E_GetAuxFunctionList)
(
AUX_FUNC_LIST_PTR_PTR pAuxFunc
);
typedef
CK_DECLARE_FUNCTION_POINTER(CK_RV, EP_GetAuxFunctionList)
(
AUX_FUNC_LIST_PTR_PTR pAuxFunc
);
#ifdef __cplusplus
}
#endif
#endif // __AUXILIARY_H__
// EOF
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -