Partager via


Encrypting Content Code Example

[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 example discussed in the following topics encrypts an item of content and writes it and the signed issuance license to a custom binary file. The content is decrypted in the Decrypting Content Code Example. The file has the following format. The custom file is used only for illustration and is not suited for a production environment. For a more realistic file container format, see Publishing Content.

  • A variable that specifies the length of the encrypted content (4 byte UINT value).
  • A variable that specifies the length of the issuance license (4 byte UINT value).
  • An array of bytes that contains the encrypted content (variable length).
  • An array of bytes that contains the issuance license (variable length).

The example requires that you enter the email address of the user and the path of the application manifest. For a more complete listing, see the Consumption sample included with the Microsoft Windows Software Development Kit (SDK). The following topics discuss the encrypting example source code.

Decrypting Content

Encrypting Content