ICertServerPolicy::SetCertificateExtension method (certif.h)
The SetCertificateExtension method adds a new extension to the certificate.
Syntax
HRESULT SetCertificateExtension(
[in] const BSTR strExtensionName,
[in] LONG Type,
[in] LONG ExtFlags,
[in] const VARIANT *pvarValue
);
Parameters
[in] strExtensionName
Specifies the object identifier (OID) for the extension to set. The string must be 31 or less nonnull characters in length.
[in] Type
Specifies the type of extension being set. The Type parameter must agree with the data type of pvarValue that is set in the vt field of the VARIANT structure. The Type parameter can be set to one of the following types.
[in] ExtFlags
Specifies the flags for the extension being set. Use a value of zero if no flag is to be set, or use one of the following flag values. You can join these flags together by using the OR operator, and you can also join them by using the OR operator with policy private extension flags (the high 8 bits of the EXTENSION_POLICY_MASK field).
Value | Meaning |
---|---|
|
This is a critical extension. |
|
Extension will not be used. |
[in] pvarValue
Specifies the value associated with the extension. Note the value's VARIANT type must agree with the Type parameter, as shown in the following table.
Value | Meaning |
---|---|
|
VT_I4 |
|
VT_DATE |
|
VT_BSTR |
|
VT_BSTR |
Return value
VB
If the method succeeds, the method returns S_OK.If the method fails, it returns an HRESULT value that indicates the error. For a list of common error codes, see Common HRESULT Values.
Remarks
Use extensions to include additional information with the certificate, such as supplemental subject or usage information. For more information, see Extension Handlers.
Call the SetCertificateExtension method from your implementation of the ICertPolicy2::VerifyRequest method. You must call the ICertServerPolicy::SetContext method before calling the SetCertificateExtension method.
Requirements
Requirement | Value |
---|---|
Minimum supported client | None supported |
Minimum supported server | Windows Server 2003 [desktop apps only] |
Target Platform | Windows |
Header | certif.h (include Certsrv.h) |
Library | Certidl.lib |
DLL | Certcli.dll |