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.


HRESULT Initialize(
  IObjectId    *pObjectId,
  EncodingType Encoding,
  BSTR         strEncodedData



Pointer to an IObjectId interface that contains the extension OID.


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


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
The OID could not be found.


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.


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