C_Encrypt

This function operates as specified in PKCS#11 except for the following:

>Symmetric cipher operations are terminated by this function. 

>C_Encrypt can be used to terminate a multi-part operation. 

Although this function will terminate the current encryption operation, the session’s encryption state will not be cleared.

NOTE   If the mechanism in use is a multi-part mechanism and the data supplied exceeds a single block, that portion of the data is processed regardless of the result returned by the call. For example if 12 bytes are passed to a DES ECB operation, 8 bytes are processed even though an error result (due to the padding requirements not being met) is returned.

Cryptoki specifies that a successful return from one of these functions (when not used for length prediction) should result in the cipher state of that session being reset (to the uninitialized state). ProtectToolkit-C, however, leaves the state initialized so that another operation (using the same key) may be performed without calling the appropriate C_xxxInit function. 

Synopsis

C_Encrypt(
        CK_SESSION_HANDLE hSession,
        CK_BYTE_PTR pData,
        CK_ULONG ulDataLen,
        CK_BYTE_PTR pEncryptedData,
        CK_ULONG_PTR pulEncryptedDataLen
);