CryptXmlAddObject function (cryptxml.h)

The CryptXmlAddObject function adds the Object element to the Signature in the Document Context opened for encoding.


HRESULT CryptXmlAddObject(
  [in]            HCRYPTXML                hSignatureOrObject,
                  DWORD                    dwFlags,
  [in, optional]  const CRYPT_XML_PROPERTY *rgProperty,
  [in]            ULONG                    cProperty,
  [in]            const CRYPT_XML_BLOB     *pEncoded,
  [out, optional] const CRYPT_XML_OBJECT   **ppObject


[in] hSignatureOrObject

The handle of a Signature returned by the CryptXmlOpenToEncode function or the handle of a Reference returned by the CryptXmlCreateReference function with the CRYPT_XML_FLAG_CREATE_REFERENCE_AS_OBJECT flag set.


Specifies flags that control the manner in which the object is added.

Currently defined dwFlags values are shown in the following table .

Value Meaning
When set, an in-memory copy of the XML part is created and included in the Object element.

[in, optional] rgProperty

A pointer to a CRYPT_XML_PROPERTY structure that specifies additional properties used to decode the Object element.

[in] cProperty

The number of elements in the array pointed to by the rgProperty property.

[in] pEncoded

A pointer to a CRYPT_XML_BLOB structure that contains the Object element.

[out, optional] ppObject

A pointer to a pointer to a CRYPT_XML_OBJECT structure to receive the decoded structure. This parameter must be NULL when the hSignatureOrObject parameter contains a handle to the Object.

Return value

If the function succeeds, the function returns zero.

If the function fails, it returns an HRESULT value that indicates the error.


When the hSignatureOrObject parameter specifies a handle to a Reference returned by the CryptXmlCreateReference function, the pEncoded parameter specifies XML content that is included in the Object node after the optional Manifest element. The pointer contained in the pEncoded parameter must be valid until the signature is complete. Otherwise, use the CRYPT_XML_FLAG_ADD_OBJECT_CREATE_COPY flag to create an in-memory copy.


Minimum supported client Windows 7 [desktop apps only]
Minimum supported server Windows Server 2008 R2 [desktop apps only]
Target Platform Windows
Header cryptxml.h
Library Cryptxml.lib
DLL Cryptxml.dll