PFN_CRYPT_SIGN_AND_ENCODE_HASH_FUNC function pointer
The PFN_CRYPT_SIGN_AND_ENCODE_HASH_FUNC callback function is called to sign and encode a computed hash.
Syntax
typedef BOOL ( WINAPI *PFN_CRYPT_SIGN_AND_ENCODE_HASH_FUNC)( _In_ NCRYPT_KEY_HANDLE hKey, _In_ DWORD dwCertEncodingType, _In_ PCRYPT_ALGORITHM_IDENTIFIER pSignatureAlgorithm, _In_ void *pvDecodedSignPara, _In_ LPCWSTR pwszCNGPubKeyAlgid, _In_ LPCWSTR pwszCNGHashAlgid, _In_ BYTE *pbComputedHash, _In_ DWORD cbComputedHash, _Out_ BYTE *pbSignature, _Inout_ DWORD *pcbSignature );
Parameters
- hKey [in]
-
A handle to the Cryptography API: Next Generation (CNG) private key to use to sign the hash.
- dwCertEncodingType [in]
-
Specifies the type of encoding used. It is always acceptable to specify both the certificate and message encoding types by combining them with a bitwise-OR operation as shown in the following example:
X509_ASN_ENCODING | PKCS_7_ASN_ENCODING
Currently defined encoding types are:
- X509_ASN_ENCODING
- PKCS_7_ASN_ENCODING
- pSignatureAlgorithm [in]
-
A pointer to a CRYPT_ALGORITHM_IDENTIFIER structure that contains the signature object identifier (OID) and its optional encoded parameters.
- pvDecodedSignPara [in]
-
An optional pointer to the decoded signature parameters data structure previously returned by the PFN_CRYPT_EXTRACT_ENCODED_SIGNATURE_PARAMETERS_FUNC function.
- pwszCNGPubKeyAlgid [in]
-
A Unicode string that contains the CNG public key algorithm identifier that corresponds to pSignatureAlgorithm->pszObjId.
- pwszCNGHashAlgid [in]
-
A Unicode string that contains the CNG hash algorithm identifier that corresponds to pSignatureAlgorithm->pszObjId or to a hash algorithm identifier in pvDecodedSignPara.
- pbComputedHash [in]
-
A pointer to the computed hash bytes returned by the BCryptFinishHash function that corresponds to pwszCNGHashAlgid.
- cbComputedHash [in]
-
A value that represents the length, in bytes, of the computed hash.
- pbSignature [out]
-
A pointer to the encoded signature bytes.
- pcbSignature [in, out]
-
A value that represents the length, in bytes, of the encoded signature.
Return value
If the function succeeds, the function returns nonzero (TRUE).
If the function fails, it returns zero (FALSE). For extended error information, call GetLastError.
If this callback function does not support the signature algorithm, it must return FALSE and call SetLastError with ERROR_NOT_SUPPORTED.
Remarks
You can use OID Support Functions to deploy this callback function. Wincrypt.h defines the following constant for this purpose.
| Constant | Definition |
|---|---|
| CRYPT_OID_SIGN_AND_ENCODE_HASH_FUNC | "CryptDllSignAndEncodeHash" |
Requirements
|
Minimum supported client |
Windows Vista [desktop apps only] |
|---|---|
|
Minimum supported server |
Windows Server 2008 [desktop apps only] |
|
Header |
|