ICertProperty::InitializeDecode method (certenroll.h)

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.

Syntax

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

Parameters

[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 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/value Description
HRESULT_FROM_WIN32(ERROR_ALREADY_INITIALIZED)
The object is already initialized.

Remarks

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:

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

ICertProperties

ICertProperty