HID® Crescendo® PKCS11
Loading...
Searching...
No Matches
c_decrypt.h File Reference
#include <pkcs11/v2.40/cryptoki.h>
Include dependency graph for c_decrypt.h:

Functions

CK_RV C_Decrypt (CK_SESSION_HANDLE hSession, CK_BYTE_PTR pEncryptedData, CK_ULONG ulEncryptedDataLen, CK_BYTE_PTR pData, CK_ULONG_PTR pulDataLen)
 Decrypts encrypted data in a single part.
 
CK_RV C_DecryptFinal (CK_SESSION_HANDLE hSession, CK_BYTE_PTR pLastPart, CK_ULONG_PTR pulLastPartLen)
 Finishes a multiple-part decryption operation.
 
CK_RV C_DecryptInit (CK_SESSION_HANDLE hSession, CK_MECHANISM_PTR pMechanism, CK_OBJECT_HANDLE hKey)
 Initializes a decryption operation.
 
CK_RV C_DecryptUpdate (CK_SESSION_HANDLE hSession, CK_BYTE_PTR pEncryptedPart, CK_ULONG ulEncryptedPartLen, CK_BYTE_PTR pPart, CK_ULONG_PTR pulPartLen)
 Continues a multiple-part decryption operation, processing another encrypted data part.
 

Function Documentation

◆ C_Decrypt()

CK_RV C_Decrypt ( CK_SESSION_HANDLE hSession,
CK_BYTE_PTR pEncryptedData,
CK_ULONG ulEncryptedDataLen,
CK_BYTE_PTR pData,
CK_ULONG_PTR pulDataLen )

Decrypts encrypted data in a single part.

Parameters
[in]hSessionis the session's handle.
[in]pEncryptedDatapoints to the encrypted data.
[in]ulEncryptedDataLenis the length of the encrypted data.
[in,out]pDatapoints to the location that receives the recovered data.
[in,out]pulDataLenpoints to the location that holds the length of the recovered data.

C_Decrypt uses the convention described in Section 5.2 on producing output.

The decryption operation MUST have been initialized with C_DecryptInit. A call to C_Decrypt always terminates the active decryption operation unless it returns CKR_BUFFER_TOO_SMALL or is a successful call (i.e., one which returns CKR_OK) to determine the length of the buffer needed to hold the plaintext.

C_Decrypt cannot be used to terminate a multi-part operation, and MUST be called after C_DecryptInit without intervening C_DecryptUpdate calls.

The ciphertext and plaintext can be in the same place, i.e., it is OK if pEncryptedData and pData point to the same location.

If the input ciphertext data cannot be decrypted because it has an inappropriate length, then either CKR_ENCRYPTED_DATA_INVALID or CKR_ENCRYPTED_DATA_LEN_RANGE may be returned.

For most mechanisms, C_Decrypt is equivalent to a sequence of C_DecryptUpdate operations followed by C_DecryptFinal.

Returns

◆ C_DecryptFinal()

CK_RV C_DecryptFinal ( CK_SESSION_HANDLE hSession,
CK_BYTE_PTR pLastPart,
CK_ULONG_PTR pulLastPartLen )

Finishes a multiple-part decryption operation.

Parameters
[in]hSessionis the session's handle.
[out]pLastPartpoints to the location that receives the last recovered data part, if any.
[in,out]pulLastPartLenpoints to the location that holds the length of the last recovered data part.

C_DecryptFinal uses the convention described in Section 5.2 on producing output.

The decryption operation MUST have been initialized with C_DecryptInit. A call to C_DecryptFinal always terminates the active decryption operation unless it returns CKR_BUFFER_TOO_SMALL or is a successful call (i.e., one which returns CKR_OK) to determine the length of the buffer needed to hold the plaintext.

If the input ciphertext data cannot be decrypted because it has an inappropriate length, then either CKR_ENCRYPTED_DATA_INVALID or CKR_ENCRYPTED_DATA_LEN_RANGE may be returned.

Returns

◆ C_DecryptInit()

CK_RV C_DecryptInit ( CK_SESSION_HANDLE hSession,
CK_MECHANISM_PTR pMechanism,
CK_OBJECT_HANDLE hKey )

Initializes a decryption operation.

Parameters
[in]hSessionis the session's handle.
[in]pMechanismpoints to the decryption mechanism.
[in]hKeyis the handle of the decryption key.

The CKA_DECRYPT attribute of the decryption key, which indicates whether the key supports decryption, MUST be CK_TRUE.

After calling C_DecryptInit, the application can either call C_Decrypt to decrypt data in a single part; or call C_DecryptUpdate zero or more times, followed by C_DecryptFinal, to decrypt data in multiple parts. The decryption operation is active until the application uses a call to C_Decrypt or C_DecryptFinal to actually obtain the final piece of plaintext. To process additional data (in single or multiple parts), the application MUST call C_DecryptInit again

Returns

◆ C_DecryptUpdate()

CK_RV C_DecryptUpdate ( CK_SESSION_HANDLE hSession,
CK_BYTE_PTR pEncryptedPart,
CK_ULONG ulEncryptedPartLen,
CK_BYTE_PTR pPart,
CK_ULONG_PTR pulPartLen )

Continues a multiple-part decryption operation, processing another encrypted data part.

Parameters
[in]hSessionis the session's handle.
[in]pEncryptedPartpoints to the encrypted data part.
[in]ulEncryptedPartLenis the length of the encrypted data part.
[out]pPartpoints to the location that receives the recovered data part.
[in,out]pulPartLenpoints to the location that holds the length of the recovered data part.

C_DecryptUpdate uses the convention described in Section 5.2 on producing output.

The decryption operation MUST have been initialized with C_DecryptInit. This function may be called any number of times in succession. A call to C_DecryptUpdate which results in an error other than CKR_BUFFER_TOO_SMALL terminates the current decryption operation.

The ciphertext and plaintext can be in the same place, i.e., it is OK if pEncryptedPart and pPart point to the same location.

Returns