Cryptoki: a cryptographic Token Interface



Download 360.55 Kb.
Page94/196
Date22.12.2023
Size360.55 Kb.
#63026
1   ...   90   91   92   93   94   95   96   97   ...   196
v201-95
pkcs11-base-v2.40-cos01

C_Logout


CK_DEFINE_FUNCTION(CK_RV, C_Logout)(
CK_SESSION_HANDLE hSession
);
C_Logout logs a user out from a token. hSession is the session’s handle.
Depending on the current user type, if the call succeeds, each of the application’s sessions will enter either the “R/W Public Session” state or the “R/O Public Session” state.
When C_Logout successfully executes, any of the application’s handles to private objects become invalid (even if a user is later logged back into the token, those handles remain invalid). In addition, all private session objects from sessions belonging to the application are destroyed.
If there are any active cryptographic or object-finding operations in an application’s session, and then C_Logout is successfully executed by that application, it may or may not be the case that those operations are still active. Therefore, before logging out, any active operations should be finished.
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_SESSION_CLOSED, CKR_SESSION_HANDLE_INVALID, CKR_USER_NOT_LOGGED_IN.
Example:
CK_SESSION_HANDLE hSession;
CK_CHAR userPIN[] = {“MyPIN”};
CK_RV rv;

rv = C_Login(hSession, CKU_USER, userPIN, sizeof(userPIN));


if (rv == CKR_OK) {
.
.
.
rv == C_Logout(hSession);
if (rv == CKR_OK) {
.
.
.
}
}

10.7. Object management functions


Cryptoki provides the following functions for managing objects. Additional functions provided specifically for managing key objects are described in Section .
  • C_CreateObject


CK_DEFINE_FUNCTION(CK_RV, C_CreateObject)(
CK_SESSION_HANDLE hSession,
CK_ATTRIBUTE_PTR pTemplate,
CK_ULONG ulCount,
CK_OBJECT_HANDLE_PTR phObject
);

Download 360.55 Kb.

Share with your friends:
1   ...   90   91   92   93   94   95   96   97   ...   196




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

    Main page