Logo 
Search:

Sharepoint Forum

Ask Question   UnAnswered
Home » Forum » Sharepoint       RSS Feeds

Custom IRM Protector

  Asked By: Miriam    Date: Oct 05    Category: Sharepoint    Views: 1496

The SDK has some light documentation on creating custom IRM protectors, but no reference as to where to get the interfaces or the class definitions for the supporting classes. Is there a typelib somewhere? I can't find it. A sample project would be nice too. The documentation has a sample pseudo-implementation, but there's no way to get started without the COM interface definition.

Share: 

 

1 Answer Found

 
Answer #1    Answered By: Ivy Salinas     Answered On: Oct 05

You can find documentation  on the interface  in the ECM Starter Kit: http://www.microsoft.com/downloads/details.aspx?familyid=38CA6B32-44BE-4489-8526-F09C57CD13A5&displaylang=en

There is a header containing the definition  (msoipi.h) in the kit (look in the folder ECM Starter Kit\White Papers\Information Rights Management where the kit is installed)

//

// msoipi.h - Microsoft IRM Protector Interface

//

// Copyright (C) 2006 Microsoft Corporation

//

// Version 1.1

//

// THIS IS PRELIMINARY DOCUMENTATION AND SUBJECT TO CHANGE.

// LAST UPDATED: May 19th, 2006


#ifndef _MSOIPI_H

#define _MSOIPI_H

#include <objbase.h>

//****************************************************************************

// I_IrmCrypt

//****************************************************************************

#undef INTERFACE

#define INTERFACE I_IrmCrypt

MIDL_INTERFACE("598F03E8-948A-425e-B7B2-2D613CEDFFEF")

I_IrmCrypt: public IUnknown

{

STDMETHOD(HrGetBlockSize) (THIS_

/*[OUT]*/ DWORD *pdwBlockSize) PURE;

STDMETHOD(HrEncrypt) (THIS_

/*[IN]*/ ULONG ulOffset,

/*[IN/OUT]*/ BYTE *pbData,

/*[IN]*/ DWORD cbData,

/*[OUT]*/ DWORD *pcbData) PURE;

STDMETHOD(HrDecrypt) (THIS_

/*[IN]*/ ULONG ulOffset,

/*[IN/OUT]*/ BYTE *pbData,

/*[IN]*/ DWORD cbData,

/*[OUT]*/ DWORD *pcbData) PURE;

STDMETHOD(HrEncode) (THIS_

/*[IN]*/ WCHAR *wszAlgID,

/*[IN]*/ UINT uDataLen,

/*[IN]*/ BYTE *pbDecodedData,

/*[IN/OUT]*/ UINT *puEncodedStringLen,

/*[OUT]*/ WCHAR *wszEncodedString) PURE;

STDMETHOD(HrDecode) (THIS_

/*[IN]*/ WCHAR *wszAlgID,

/*[IN]*/ WCHAR *wszEncodedString,

/*[IN/OUT]*/ UINT *puDecodedDataLen,

/*[OUT]*/ BYTE *pbDecodedData) PURE;

};

// {598F03E8-948A-425e-B7B2-2D613CEDFFEF}

DEFINE_GUID(IID_I_IrmCrypt,

0x598f03e8, 0x948a, 0x425e, 0xb7, 0xb2, 0x2d, 0x61, 0x3c, 0xed, 0xff, 0xef);

//****************************************************************************

// I_IrmPolicyInfoRMS

//****************************************************************************

#undef INTERFACE

#define INTERFACE I_IrmPolicyInfoRMS

MIDL_INTERFACE("175EF0A4-8EB8-49ac-9049-F40EC69EC0A7")

I_IrmPolicyInfoRMS: public IUnknown

{

STDMETHOD(HrGetICrypt) (THIS_

/*[OUT]*/ I_IrmCrypt **piic) PURE;

STDMETHOD(HrGetSignedIL) (THIS_

/*[OUT]*/ BSTR *pbstrIL) PURE;

STDMETHOD(HrGetServerEUL) (THIS_

/*[OUT]*/ BSTR *pbstrEUL) PURE;

STDMETHOD(HrGetServerId) (THIS_

/*[OUT]*/ BSTR *pbstrServerId) PURE;

STDMETHOD(HrGetEULs) (THIS_

/*[OUT]*/ BSTR *rgbstrEUL,

/*[OUT]*/ BSTR *rgbstrId,

/*[OUT]*/ UINT *pcbEULs) PURE;

STDMETHOD(HrSetSignedIL) (THIS_

/*[IN]*/ BSTR bstrIL) PURE;

STDMETHOD(HrSetServerEUL) (THIS_

/*[IN]*/ BSTR bstrEUL) PURE;

STDMETHOD(HrGetRightsTemplate) (THIS_

/*[OUT]*/ BSTR* pbstrRightsTemplate) PURE;

STDMETHOD(HrGetListGuid) (THIS_

/*[OUT]*/ BSTR* pbstrListGuid) PURE;

};

// {175EF0A4-8EB8-49ac-9049-F40EC69EC0A7}

DEFINE_GUID(IID_I_IrmPolicyInfoRMS,

0x175ef0a4, 0x8eb8, 0x49ac, 0x90, 0x49, 0xf4, 0xe, 0xc6, 0x9e, 0xc0, 0xa7);

//****************************************************************************

// I_IrmPolicyInfo

//****************************************************************************

#undef INTERFACE

#define INTERFACE I_IrmPolicyInfo

MIDL_INTERFACE("2CDC48E9-DB49-47E6-8487-A2EA1FCE292F")

I_IrmPolicyInfo: public IUnknown

{

STDMETHOD(HrGetListGuid) (THIS_

/*[OUT]*/ BSTR* pbstrListGuid) PURE;

STDMETHOD(HrSetListGuid) (THIS_

/*[IN]*/ BSTR bstrListGuid) PURE;

STDMETHOD(HrGetRightsMask) (THIS_

/*[OUT]*/ DWORD* pdwRightsMask) PURE;

STDMETHOD(HrGetRequestingUser) (THIS_

/*[OUT]*/ BSTR* pbstrRequestingUser,

/*[OUT]*/ BOOL* pfRequestingUserIsSystem) PURE;

STDMETHOD(HrGetURL) (THIS_

/*[OUT]*/ BSTR* pbstrURL) PURE;

STDMETHOD(HrGetPolicyTitle) (THIS_

/*[OUT]*/ BSTR* pbstrPolicyTitle) PURE;

STDMETHOD(HrGetPolicyDescription) (THIS_

/*[OUT]*/ BSTR* pbstrPolicyDescription) PURE;

STDMETHOD(HrGetOfflineDays) (THIS_

/*[OUT]*/ DWORD* pdwOfflineDays) PURE;

};

// Rights for HrGetRightsMask

#define rightNone 0x0000

#define rightView 0x0001

#define rightEdit 0x0002

#define rightSave 0x0004

#define rightExtract 0x0008

#define rightPrint 0x0010

#define rightVBA 0x0020 //Not used in SharePoint

#define rightAdmin 0x0040

#define rightForward 0x0080 //Not used in SharePoint

#define rightReply 0x0100 //Not used in SharePoint

#define rightReplyAll 0x0200 //Not used in SharePoint

#define rightAll 0xFFFF //Not used in SharePoint



// {2CDC48E9-DB49-47E6-8487-A2EA1FCE292F}

DEFINE_GUID(IID_I_IrmPolicyInfo,

0x2cdc48e9, 0xdb49, 0x47e6, 0x84, 0x87, 0xa2, 0xea, 0x1f, 0xce, 0x29, 0x2f);

//****************************************************************************

// I_IrmProtector

//****************************************************************************

#undef INTERFACE

#define INTERFACE I_IrmProtector

MIDL_INTERFACE("fcfbc0ac-672b-452d-80e5-40652503d96e")

I_IrmProtector: public IUnknown

{

STDMETHOD(HrInit) (THIS_

/*[OUT]*/ BSTR *pbstrProduct,

/*[OUT]*/ DWORD *pdwVersion,

/*[OUT]*/ BSTR *pbstrExtentions,

/*[OUT]*/ BOOL *pfUseRMS) PURE;

STDMETHOD(HrIsProtected) (THIS_

/*[IN]*/ ILockBytes *pilbInput,

/*[OUT]*/ DWORD *pdwResult) PURE;

STDMETHOD(HrSetLangId) (THIS_

/*[IN]*/ LANGID langid) PURE;

STDMETHOD(HrProtectRMS) (THIS_

/*[IN]*/ ILockBytes *pilbInput,

/*[IN]*/ ILockBytes *pilbOutput,

/*[IN]*/ I_IrmPolicyInfoRMS *piid,

/*[OUT]*/ DWORD *pdwStatus) PURE;

STDMETHOD(HrUnprotectRMS) (THIS_

/*[IN]*/ ILockBytes *pilbInput,

/*[IN]*/ ILockBytes *pilbOutput,

/*[IN]*/ I_IrmPolicyInfoRMS *piid,

/*[OUT]*/ DWORD *pdwStatus) PURE;

STDMETHOD(HrProtect) (THIS_

/*[IN]*/ ILockBytes *pilbInput,

/*[IN]*/ ILockBytes *pilbOutput,

/*[IN]*/ I_IrmPolicyInfo *piid,

/*[OUT]*/ DWORD *pdwStatus) PURE;

STDMETHOD(HrUnprotect) (THIS_

/*[IN]*/ ILockBytes *pilbInput,

/*[IN]*/ ILockBytes *pilbOutput,

/*[IN]*/ I_IrmPolicyInfo *piid,

/*[OUT]*/ DWORD *pdwStatus) PURE;

};

//HrIsProtected possible results:

#define MSOIPI_RESULT_UNKNOWN 0 //I cannot tell. Ask me in HrProtect/HrUnprotect

#define MSOIPI_RESULT_PROTECTED 1 //pilbInput is protected

#define MSOIPI_RESULT_UNPROTECTED 2 //pilbInput is unprotected

#define MSOIPI_RESULT_NOT_MY_FILE 3 //Not my file. For example, an XML file that is not an InfoPath form.

// Status:

#define MSOIPI_STATUS_UNKNOWN 0

#define MSOIPI_STATUS_PROTECT_SUCCESS 1

#define MSOIPI_STATUS_UNPROTECT_SUCCESS 2

#define MSOIPI_STATUS_ALREADY_PROTECTED 3 //If called to protect and file is already protected

#define MSOIPI_STATUS_CANT_PROTECT 4 //If protect fails

#define MSOIPI_STATUS_ALREADY_UNPROTECTED 5 //If called to unprotect and file is already unprotected

#define MSOIPI_STATUS_CANT_UNPROTECT 6 //If unprotect fails

#define MSOIPI_STATUS_NOT_OWNER 7 //If the ServerId doesn't have an EUL that allows unprotection

//Unused 8

#define MSOIPI_STATUS_NOT_MY_FILE 9 //If the protector is passed a file it cannot identify

#define MSOIPI_STATUS_FILE_CORRUPT 10 //If the parts of the file that make this an IRM file are corrupt

#define MSOIPI_STATUS_PLATFORM_IRM_FAILED 11 //If a call back into the platform for RMS APIs fails

#define MSOIPI_STATUS_BAD_INSTALL 12 //If the protector isn't installed properly

// {FCFBC0AC-672B-452d-80E5-40652503D96E}

DEFINE_GUID(IID_I_IrmProtector,

0xfcfbc0ac, 0x672b, 0x452d, 0x80, 0xe5, 0x40, 0x65, 0x25, 0x03, 0xd9, 0x6e);

#endif

 
Didn't find what you were looking for? Find more on Custom IRM Protector Or get search suggestion and latest updates.




Tagged: