DRMConstructCertificateChain function (msdrm.h)

[The AD RMS SDK leveraging functionality exposed by

the client in Msdrm.dll is available for use in Windows Server 2008, Windows Vista, Windows Server 2008 R2, Windows 7, Windows Server 2012, and Windows 8. It may be altered or

unavailable in subsequent versions. Instead, use Active Directory Rights Management Services SDK 2.1,

which leverages functionality exposed by the client in Msipc.dll.]

The DRMConstructCertificateChain function builds a certificate chain from an arbitrary number of certificates.

Syntax

DRMEXPORT HRESULT UDAPICALL DRMConstructCertificateChain(
  [in]      UINT  cCertificates,
  [in]      PWSTR *rgwszCertificates,
  [in, out] UINT  *pcChain,
  [out]     PWSTR wszChain
);

Parameters

[in] cCertificates

The number of certificates in the rgwszCertificates array.

[in] rgwszCertificates

An array of null-terminated Unicode string pointers that contain the certificates to construct the chain from. The number of elements in this array is specified by the cCertificates parameter.

[in, out] pcChain

A pointer to a UINT that, on input, contains the size, in Unicode characters, of the wszChain string. This character count must include the terminating null character.

On output, this UINT receives the number of Unicode characters copied into the buffer, including the terminating null character.

[out] wszChain

A pointer to a null-terminated Unicode string that receives the constructed chain.

To determine the required size for this buffer, call this function with NULL for the wszChain parameter. The required number of Unicode characters, including the terminating null character, will be returned in the pcChain parameter.

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 list. For a list of common error codes, see Common HRESULT Values.

Remarks

Memory allocation and deallocation for the chain are handled by the caller. To determine the required size for the wszChain buffer, call this function with NULL for the wszChain parameter. The required number of Unicode characters, including the terminating null character, will be returned in the pcChain parameter.

This function can be used to transform certificate chains that are returned by the AD RMS SOAP methods into certificate chains that can be used by AD RMS functions. For an example, see Decryption_GetBoundLicense.cpp.

Requirements

Requirement Value
Target Platform Windows
Header msdrm.h
Library Msdrm.lib
DLL Msdrm.dll

See also

AD RMS Functions

Decryption_GetBoundLicense.cpp