CryptXmlSign function
The CryptXmlSign function creates a cryptographic signature of a SignedInfo element.
Syntax
HRESULT WINAPI CryptXmlSign( _In_ HCRYPTXML hSignature, _In_opt_ HCRYPTPROV_OR_NCRYPT_KEY_HANDLE hKey, DWORD dwKeySpec, DWORD dwFlags, CRYPT_XML_KEYINFO_SPEC dwKeyInfoSpec, _In_opt_ const void pvKeyInfoSpec, _In_ const CRYPT_XML_ALGORITHM pSignatureMethod, _In_ const CRYPT_XML_ALGORITHM pCanonicalization );
Parameters
- hSignature [in]
-
The handle to a CRYPT_XML_SIGNATURE structure.
- hKey [in, optional]
-
The handle of a private key used to sign the SignedInfo element. This parameter must be NULL for HMAC-based signature algorithms.
- dwKeySpec
-
A DWORD value that specifies the key type. This parameter can be one of the following values.
Value Meaning - AT_KEYEXCHANGE
- 1
The key pair is a key exchange pair.
- AT_SIGNATURE
- 2
The key pair is a signature pair.
- CERT_NCRYPT_KEY_SPEC
- 0xFFFFFFFF
The key is a Cryptography API: Next Generation (CNG) key.
- dwFlags
-
A DWORD value that controls how the data is signed. This parameter can be one of the following values.
- dwKeyInfoSpec
-
The type of data structure pointed to by the pvKeyInfoSpec parameter. Here are some possible combinations.
dwKeyInfec pvKeyInfoSpec CRYPT_XML_KEYINFO_SPEC_NONE
Is set to NULL
CRYPT_XML_KEYINFO_SPEC_ENCODED
Points to a CRYPT_XML_BLOB structure
CRYPT_XML_KEYINFO_SPEC_PARAM
Points to a CRYPT_XML_KEYINFO_PARAM structure
- pvKeyInfoSpec [in, optional]
-
A pointer to a structure, the type of which is determined by the value of the dwKeyInfoSpec parameter.
- pSignatureMethod [in]
-
A pointer to a CRYPT_XML_ALGORITHM structure that specifies the signature method.
- pCanonicalization [in]
-
A pointer to a CRYPT_XML_ALGORITHM structure that specifies the canonicalization method.
Return value
If the function succeeds, the function returns zero.
If the function fails, it returns an HRESULT value that indicates the error.
Requirements
|
Minimum supported client |
Windows 7 [desktop apps only] |
|---|---|
|
Minimum supported server |
Windows Server 2008 R2 [desktop apps only] |
|
Header |
|
|
Library |
|
|
DLL |
|