FC_Login() - log a user into a token.
CK_RV FC_Login( CK_SESSION_HANDLE hSession, CK_USER_TYPE userType, CK_CHAR_PTR pPin, CK_ULONG ulPinLen );
FC_Login() takes four parameters:
- [in] a session handle
- [in] the user type (
- [in] a pointer that points to the user's PIN
- [in] the length of the PIN
FC_Login() logs a user into a token.
The Security Officer (
CKU_SO) only logs in to initialize the normal user's PIN. The SO PIN is the empty string. The NSS cryptographic module doesn't allow the SO to log in if the normal user's PIN is already initialized.
FC_Login() returns the following return codes.
CKR_OK: the user logged in successfully.
CKR_DEVICE_ERROR: the token is in the Error state.
CKR_HOST_MEMORY: memory allocation failed.
CKR_PIN_INCORRECT: the PIN is incorrect.
CKR_PIN_LEN_RANGE: the PIN is too long (
ulPinLenis greater than 255).The function should return
CKR_PIN_INCORRECTin this case.
CKR_SESSION_HANDLE_INVALID: the session handle is invalid.
CKR_USER_ALREADY_LOGGED_IN: the user is already logged in.
- The token can't authenticate the user because there is no key database or the user's password isn't initialized.
CKU_SOand the normal user's PIN is already initialized.