CertSetCRLContextProperty function (wincrypt.h)
The CertSetCRLContextProperty function sets an extended property for the specified certificate revocation list (CRL) context.
Syntax
BOOL CertSetCRLContextProperty(
[in] PCCRL_CONTEXT pCrlContext,
[in] DWORD dwPropId,
[in] DWORD dwFlags,
[in] const void *pvData
);
Parameters
[in] pCrlContext
A pointer to the CRL_CONTEXT structure.
[in] dwPropId
Identifies the property to be set. The value of dwPropId determines the type and content of the pvData parameter. Currently defined identifiers and the data type to be returned in pvData are listed in the following table.
Usually, only the following properties are set:
- CERT_HASH_PROP_ID
- CERT_SHA1_HASH_PROP_ID
- CERT_MD5_HASH_PROP_ID
- CERT_SIGNATURE_HASH_PROP_ID
Value | Meaning |
---|---|
|
Data type for pvData: pointer to a DWORD
Sets a DWORD value indicating whether write operations to the certificate are persisted. The DWORD value is not set if the certificate is in a memory store or in a registry-based store that is opened as read-only. |
|
Data type for pvData: NULL
Indicates the certificate is skipped during enumerations. A certificate with this property set is found with explicit search operations, such as those used to find a certificate with a specific hash or a serial number. No data in pvData is associated with this property. |
|
Data type for pvData: pointer to a BYTE array
Sets a null-terminated Unicode string naming the certificate type for which the certificate has been auto enrolled. |
|
Data type for pvData: pointer to a BYTE array
Sets an array of bytes containing an Abstract Syntax Notation One (ASN.1) encoded CTL_USAGE structure. |
|
Data type for pvData: pointer to a BYTE array
Sets the property displayed by the certificate UI. This property allows the user to describe the certificate's use. |
|
Data type for pvData:
Sets an array of bytes containing an ASN.1 encoded CERT_ENHKEY_USAGE structure. |
|
Data type for pvData: pointer to a BYTE array
Sets a null-terminated Unicode character string that contains the display name for the CRL. |
|
Data type for pvData: Pointer to a CRYPT_DATA_BLOB structure.
Sets a string containing a set of L"<PUBKEY>/<BITLENGTH>" public key algorithm and bit length pairs. The semicolon, L";", is used as the delimiter. The <PUBKEY> value identifies the CNG public key algorithm. The following algorithms are supported:
Note This property should not be set for a delegated OCSP signer certificate. A delegated signer certificate is signed with the same key used to sign the subject certificate and is checked there.
: L"RSA/2048;RSA/4096" |
|
Data type for pvData: Pointer to a CRYPT_DATA_BLOB structure.
Sets a string that contains a set of L"<SIGNATURE>/<HASH>" algorithm pairs. The semicolon, L";", is used as the delimiter between pairs. This property is set only when an OCSP response is converted to a CRL. For a delegated OCSP signer certificate, only the algorithm pair for the signer certificate is returned. For an independent OCSP signer certificate chain, an algorithm pair is returned for each certificate in the chain excluding the root. The <SIGNATURE> value identifies the CNG public key algorithm. The following algorithms are supported:
|
|
Data type for pvData: Pointer to a CRYPT_DATA_BLOB structure.
Sets the length, in bits, of the public key in the CRL issuer certificate. This property is also applicable to an OCSP that has been converted to a CRL. This property is explicitly set by the verify revocation functions. Windows 8 and Windows Server 2012: Support for this property begins. |
|
Data type for pvData: pointer to a CERT_KEY_CONTEXT
Sets a CERT_KEY_CONTEXT structure. |
|
Data type for pvData: pointer to a BYTE array |
|
Data type for pvData: pointer to an HCRYPTPROV
Sets the provider handle obtained from the CERT_KEY_CONTEXT_PROP_ID. |
|
Data type for pvData: pointer to a CRYPT_KEY_PROV_INFO
Sets a pointer to a CRYPT_KEY_PROV_INFO structure. |
|
Data type for pvData: pointer to a DWORD
Sets a DWORD value specifying the private key obtained from CERT_KEY_CONTEXT_PROP_ID property if it exists. Otherwise, if CERT_KEY_PROV_INFO_PROP_ID exists, it is the source of the dwKeySpec. |
|
Data type for pvData: pointer to a BYTE array
Sets the MD5 hash. You can compute the hash by using the CryptHashCertificate function. |
|
Data type for pvData: pointer to a BYTE array
Sets the ASN.1 encoded CERT_ALT_NAME_INFO structure on a CTL. |
|
Data type for pvData: pointer to a BYTE array
Sets a null-terminated Unicode, wide character string specifying the name of the file that contains the private key associated with the certificate's public key. |
|
Data type for pvData: pointer to a BYTE array
Sets the SHA1 hash. You can compute the hash by using CryptHashCertificate. |
|
Data type of pvData: Pointer to a CRYPT_DATA_BLOB structure.
Sets the L”<SIGNATURE>/<HASH>” string representing the certificate signature. The <SIGNATURE> value identifies the CNG public key algorithm. The following algorithms are supported:
This property is explicitly set by the verify revocation functions. Windows 8 and Windows Server 2012: Support for this property begins. |
|
Data type for pvData: pointer to a BYTE array
Sets the signature hash. If the hash does not exist, it is computed with CryptHashToBeSigned. The length of the hash is 20 bytes for SHA and 16 for MD5. |
The user can define additional dwPropId types by using DWORD values from CERT_FIRST_USER_PROP_ID to CERT_LAST_USER_PROP_ID. For all user-defined dwPropId types, pvData points to an encoded CRYPT_DATA_BLOB.
For all the other property identifiers, pvData points to an encoded CRYPT_DATA_BLOB structure.
[in] dwFlags
CERT_STORE_NO_CRYPT_RELEASE_FLAG can be set for the CERT_KEY_PROV_HANDLE_PROP_ID or CERT_KEY_CONTEXT_PROP_ID dwPropId properties.
If the CERT_SET_PROPERTY_IGNORE_PERSIST_ERROR_FLAG value is set, any provider-write errors are ignored and the cached context's properties are always set.
If the CERT_SET_PROPERTY_INHIBIT_PERSIST_FLAG is set, any property set is not persisted.
[in] pvData
A pointer to a data type that is determined by the value passed in dwPropId.
Return value
If the function succeeds, the return value is TRUE.
If the function fails, the return value is FALSE. For extended error information, call GetLastError. One possible error code is the following.
Return code | Description |
---|---|
|
The property is not valid. The identifier specified was greater than 0x0000FFFF, or, for the CERT_KEY_CONTEXT_PROP_ID property, a cbSize member that is not valid was specified in the CERT_KEY_CONTEXT structure. |
Remarks
If a property already exists, its old value is replaced.
Examples
For an example that uses this function, see Example C Program: Getting and Setting Certificate Properties.
Requirements
Requirement | Value |
---|---|
Minimum supported client | Windows XP [desktop apps | UWP apps] |
Minimum supported server | Windows Server 2003 [desktop apps | UWP apps] |
Target Platform | Windows |
Header | wincrypt.h |
Library | Crypt32.lib |
DLL | Crypt32.dll |