Cryptoki: a cryptographic Token Interface



Download 360.55 Kb.
Page82/196
Date22.12.2023
Size360.55 Kb.
#63026
1   ...   78   79   80   81   82   83   84   85   ...   196
v201-95
pkcs11-base-v2.40-cos01

C_GetSlotInfo


CK_DEFINE_FUNCTION(CK_RV, C_GetSlotInfo)(
CK_SLOT_ID slotID,
CK_SLOT_INFO_PTR pInfo
);
C_GetSlotInfo obtains information about a particular slot in the system. slotID is the ID of the slot; pInfo points to the location that receives the slot information.
Return values: CKR_CRYPTOKI_NOT_INITIALIZED, CKR_DEVICE_ERROR, CKR_FUNCTION_FAILED, CKR_GENERAL_ERROR, CKR_HOST_MEMORY, CKR_OK, CKR_SLOT_ID_INVALID.
Example: see C_GetTokenInfo.
  • C_GetTokenInfo


CK_DEFINE_FUNCTION(CK_RV, C_GetTokenInfo)(
CK_SLOT_ID slotID,
CK_TOKEN_INFO_PTR pInfo
);
C_GetTokenInfo obtains information about a particular token in the system. slotID is the ID of the token’s slot; pInfo points to the location that receives the token information.
Return values: CKR_CRYPTOKI_NOT_INITIALIZED, CKR_DEVICE_ERROR, CKR_DEVICE_MEMORY, CKR_DEVICE_REMOVED, CKR_FUNCTION_FAILED, CKR_GENERAL_ERROR, CKR_HOST_MEMORY, CKR_OK, CKR_SLOT_ID_INVALID, CKR_TOKEN_NOT_PRESENT, CKR_TOKEN_NOT_RECOGNIZED.
Example:
CK_ULONG ulCount;
CK_SLOT_ID_PTR pSlotList;
CK_SLOT_INFO slotInfo;
CK_TOKEN_INFO tokenInfo;
CK_RV rv;

rv = C_GetSlotList(FALSE, NULL_PTR, &ulCount);


if ((rv == CKR_OK) && (ulCount > 0)) {
pSlotList = (CK_SLOT_ID_PTR) malloc(ulCount*sizeof(CK_SLOT_ID));
rv = C_GetSlotList(FALSE, pSlotList, &ulCount);
assert(rv == CKR_OK);

/* Get slot information for first slot */


rv = C_GetSlotInfo(pSlotList[0], &slotInfo);
assert(rv == CKR_OK);

/* Get token information for first slot */


rv = C_GetTokenInfo(pSlotList[0], &tokenInfo);
if (rv == CKR_TOKEN_NOT_PRESENT) {
.
.
.
}
.
.
.
free(pSlotList);
}
  • C_WaitForSlotEvent


CK_DEFINE_FUNCTION(CK_RV, C_WaitForSlotEvent)(
CK_FLAGS flags,
CK_SLOT_ID_PTR pSlot,
CK_VOID_PTR pReserved
);

Download 360.55 Kb.

Share with your friends:
1   ...   78   79   80   81   82   83   84   85   ...   196




The database is protected by copyright ©ininet.org 2024
send message

    Main page