InitializeDecode Method
Collapse the table of content
Expand the table of content

ICertProperty::InitializeDecode method

The InitializeDecode method initializes the object from a byte array that contains the property value. The byte array is represented by a Unicode-encoded string.


HRESULT InitializeDecode(
  [in] EncodingType Encoding,
  [in] BSTR         strEncodedData


Encoding [in]

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

strEncodedData [in]

A BSTR variable that contains the Distinguished Encoding Rules (DER) encoded property 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/valueDescription

The object is already initialized.



Specify the property to initialize by calling the PropertyId property. You can call the RawData property to retrieve the encoded property value. Call the SetValueOnCertificate method to associate the property value with a certificate.

If the InitializeDecode method fails, the ICertProperty object is not initialized and the input property value is not saved. However, the PropertyId property retains the specified identifier.

The InitializeDecode method is provided to enable you to initialize custom properties and properties identified in the CERTENROLL_PROPERTYID enumeration for which there exist no specific interface. Each of the supported values in that enumeration contains information about the type of data, usually a CRYPT_INTEGER_BLOB, that you must supply to the InitializeDecode method. You can use the IBinaryConverter interface to convert a byte array to a string.

The following interfaces simplify creation of the most common properties:


Minimum supported client

Windows Vista [desktop apps only]

Minimum supported server

Windows Server 2008 [desktop apps only]





See also




Community Additions

© 2016 Microsoft