Cryptoki: a cryptographic Token Interface



Download 360.55 Kb.
Page113/196
Date22.12.2023
Size360.55 Kb.
#63026
1   ...   109   110   111   112   113   114   115   116   ...   196
v201-95
pkcs11-base-v2.40-cos01

C_SignRecover


CK_DEFINE_FUNCTION(CK_RV, C_SignRecover)(
CK_SESSION_HANDLE hSession,
CK_BYTE_PTR pData,
CK_ULONG ulDataLen,
CK_BYTE_PTR pSignature,
CK_ULONG_PTR pulSignatureLen
);
C_SignRecover signs data in a single operation, where the data can be recovered from the signature. hSession is the session’s handle; pData points to the data; uLDataLen is the length of the data; pSignature points to the location that receives the signature; pulSignatureLen points to the location that holds the length of the signature.
C_SignRecover uses the convention described in Section on producing output.
The signing operation must have been initialized with C_SignRecoverInit. A call to C_SignRecover always terminates the active signing 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 signature.
Return values: CKR_BUFFER_TOO_SMALL, CKR_CRYPTOKI_NOT_INITIALIZED, CKR_DATA_INVALID, CKR_DATA_LEN_RANGE, CKR_DEVICE_ERROR, CKR_DEVICE_MEMORY, CKR_DEVICE_REMOVED, CKR_FUNCTION_CANCELED, CKR_FUNCTION_FAILED, CKR_GENERAL_ERROR, CKR_HOST_MEMORY, CKR_OK, CKR_OPERATION_NOT_INITIALIZED, CKR_SESSION_CLOSED, CKR_SESSION_HANDLE_INVALID.
Example:
CK_SESSION_HANDLE hSession;
CK_OBJECT_HANDLE hKey;
CK_MECHANISM mechanism = {
CKM_RSA_9796, NULL_PTR, 0
};
CK_BYTE data[] = {...};
CK_BYTE signature[128];
CK_ULONG ulSignatureLen;
CK_RV rv;

.
.
.


rv = C_SignRecoverInit(hSession, &mechanism, hKey);
if (rv == CKR_OK) {
ulSignatureLen = sizeof(signature);
rv = C_SignRecover(
hSession, data, sizeof(data), signature, &ulSignatureLen);
if (rv == CKR_OK) {
.
.
.
}
}

10.12. Functions for verifying signatures and MACs


Cryptoki provides the following functions for verifying signatures on data (for the purposes of Cryptoki, these operations also encompass message authentication codes):
1   ...   109   110   111   112   113   114   115   116   ...   196




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

    Main page