IX509Extension::Initialize method (certenroll.h)

The Initialize method initializes an IX509Extension object by using an object identifier (OID) and a byte array that contains the Distinguished Encoding Rules (DER) encoded extension. The DER-encoded byte array is represented by a Unicode-encoded string. This method is web enabled.

Syntax

HRESULT Initialize(
  [in] IObjectId    *pObjectId,
  [in] EncodingType Encoding,
  [in] BSTR         strEncodedData
);

Parameters

[in] pObjectId

Pointer to an IObjectId interface that contains the extension OID.

[in] Encoding

An EncodingType enumeration value that specifies the type of Unicode encoding applied to the input string.

[in] strEncodedData

A BSTR variable that contains the DER-encoded extension value.

Return value

If the function succeeds, the function returns S_OK.

If the function fails, it returns an HRESULT value that indicates the error. Possible values include, but are not limited to, those in the following table. For a list of common error codes, see Common HRESULT Values.

Return code/value Description
CERTSRV_E_PROPERTY_EMPTY
The OID could not be found.

Remarks

A certificate extension consists of an OID, a Boolean value that identifies whether the extension is critical, and a byte array that contains the extension value. The extension is defined by an Abstract Syntax Notation One (ASN.1) standard and is encoded by using DER. You must specify the DER-encoded byte array as a string that is either a pure binary sequence or is Unicode encoded. You can specify the type of encoding to apply to the string by using the EncodingType enumeration.

Requirements

Requirement Value
Minimum supported client Windows Vista [desktop apps only]
Minimum supported server Windows Server 2008 [desktop apps only]
Target Platform Windows
Header certenroll.h
DLL CertEnroll.dll

See also

IX509Extension