C_EncryptInit

This function operates as specified in PKCS#11.

The session will retain its initialized state even when a C_Encrypt or C_EncryptFinal operation has occurred.

If the CKF_LOGIN_REQUIRED flag is set for the Token associated with the provided session the session state must be either CKS_RW_USER_FUNCTIONS, or CKS_RO_USER_FUNCTIONS otherwise the error result CKR_USER_NOT_LOGGED_IN is returned.

If the hKey parameter refers to a certificate object this function will perform the same certificate verification as specified in the C_VerifyInit function.

If the object referenced by the hKey parameter has the CKA_USAGE_COUNT attribute its value is incremented by this function.

Synopsis

C_EncryptInit(
        CK_SESSION_HANDLE hSession,
        CK_MECHANISM_PTR pMechanism,
        CK_OBJECT_HANDLE hKey
);