IRM Protector Development Example

Last modified: April 04, 2010

Applies to: SharePoint Foundation 2010

The following short example describes the basic steps you can take to create a custom integrated Information Rights Management (IRM) protector and integrate it with SharePoint Foundation. In this example, a developer wants to enable adding rights-managed JPEG images to a document library.

  1. The developer ensures that a client application exists that is capable of handling rights-managed JPEG images. Optionally, the developer creates this application.

    For information about creating applications for rights-managed content, see Rights Management Services SDK Documentation.

  2. The developer creates a class that implements the I_IrmProtector interface.

    Depending on the complexity of the file type, the developer may want to write stream operators or other helper functions that call I_IrmCrypt.HrEncrypt and I_IrmCrypt.HrDecrypt.

  3. Concerned with backward compatibility, the developer creates a base JPEG image to use as a document template for the developer's HrProtectRMS method to use when creating the protected content. The image consists of the text "This is an IRM protected JPEG image. You need to open this image in an IRM-aware application."

  4. The developer implements the members of the I_IrmProtector interface, as follows:

    • I_IrmProtector.HrInit Method HrInit   In this method, the developer includes code that loads the document template into memory, so that it can be referenced quickly by other functions.

    • I_IrmProtector.HrProtectRMS Method HrProtectRMS   In this method, the developer writes code that adds metadata to an instance of the document template. The code adds the issuance license (IL), the end-user license (EUL), and the protected content, which the code accesses through the piid parameter of the HrProtectRMS method and possibly the stream operators the developer created earlier.

    • HrUnprotectRMS   In this function, the developer writes code to extract the IL and EUL from the protected JPEG image, and calls SharePoint Foundation functions to decrypt the data.

    • HrIsProtected   In this property, the developer writes code that examines a JPEG image and checks for the existence of the extra metadata that the developer stores in an IRM-protected JPEG image.

    • HrSetLangID   The developer wants to enable IRM-protected JPEG files for a Japanese audience as well. He creates another document template, this time a JPEG image displaying the same message described previously, but in Japanese. The developer then implements this method and changes the HrProtectRMS method to load the correct document template based on the stored language ID value.

  5. The developer compiles his protector class as a COM object, registers the object by composing a custom .wxs file, and then applies it to the server registry.