Error while using “IpcCreateLicenseFromTemplateId” function in RMS SDK 2.1

%3CLINGO-SUB%20id%3D%22lingo-sub-830704%22%20slang%3D%22en-US%22%3EError%20while%20using%20%E2%80%9CIpcCreateLicenseFromTemplateId%E2%80%9D%20function%20in%20RMS%20SDK%202.1%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-830704%22%20slang%3D%22en-US%22%3E%3CP%3EHi%2C%3C%2FP%3E%3CP%3EI%20am%20using%20RMS%20client%202.1%20SDK%20to%20apply%20protection%20on%20PDF%20file.%3C%2FP%3E%3CP%3EClient%20has%20provided%20us%20with%20template%20ID.%3C%2FP%3E%3CP%3EBut%20when%20I%20try%20to%20use%20the%20function%3CSTRONG%3E%22IpcCreateLicenseFromTemplateId%22%26nbsp%3B%3C%2FSTRONG%3EI%20get%20error%26nbsp%3B%3C%2FP%3E%3CP%3E%3CSTRONG%3E%E2%80%9CThe%20System%20cannot%20find%20the%20file%20specified.%20HRESULT%3A%200x80070002%E2%80%9D.%3C%2FSTRONG%3E%3C%2FP%3E%3CP%3E%3CSTRONG%3E****************************************************************************************%3C%2FSTRONG%3E%3C%2FP%3E%3CP%3Estring%20viewAndPrint%20%3D%20%22xxxxx-xxxx-xxx-xxxx-xxxxxxxx%22%3B%3C%2FP%3E%3CP%3E%3CSTRONG%3E%3CU%3E%2F%2FError%20in%20thisline%3C%2FU%3E%3C%2FSTRONG%3E%3C%2FP%3E%3CP%3E%3CSTRONG%3E%3CU%3ESafeInformationProtectionLicenseHandle%20handle%20%3D%20SafeNativeMethods.IpcCreateLicenseFromTemplateId(viewAndPrint)%3B%3C%2FU%3E%3C%2FSTRONG%3E%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3ESafeNativeMethods.IpcSetLicenseUserRightsList(handle%2C%20userRights)%3B%3C%2FP%3E%3CP%3ESafeNativeMethods.IpcSetLicenseValidityTime(handle%2C%20term)%3B%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3Estring%20encryptedFilePath%20%3D%20SafeFileApiNativeMethods.IpcfEncryptFile(%3CBR%20%2F%3EfilePath%2C%3CBR%20%2F%3Ehandle%2C%3CBR%20%2F%3ESafeFileApiNativeMethods.EncryptFlags.IPCF_EF_FLAG_KEY_NO_PERSIST%2C%3CBR%20%2F%3Etrue%2Cfalse%2Ctrue%2Cnull%2CsymmetricKeyCred)%3B%3C%2FP%3E%3CP%3E****************************************************************************************%3C%2FP%3E%3CP%3EHelp%20me%20solve%20this%20error.%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-LABS%20id%3D%22lingo-labs-830704%22%20slang%3D%22en-US%22%3E%3CLINGO-LABEL%3EInformation%20Protection%3C%2FLINGO-LABEL%3E%3CLINGO-LABEL%3ERights%20Management%3C%2FLINGO-LABEL%3E%3C%2FLINGO-LABS%3E%3CLINGO-SUB%20id%3D%22lingo-sub-837458%22%20slang%3D%22en-US%22%3ERe%3A%20Error%20while%20using%20%E2%80%9CIpcCreateLicenseFromTemplateId%E2%80%9D%20function%20in%20RMS%20SDK%202.1%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-837458%22%20slang%3D%22en-US%22%3E%3CP%3E%3CA%20href%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fuser%2Fviewprofilepage%2Fuser-id%2F366101%22%20target%3D%22_blank%22%3E%40chandrashekharazad%3C%2FA%3E%26nbsp%3B%3CA%20href%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fuser%2Fviewprofilepage%2Fuser-id%2F3319%22%20target%3D%22_blank%22%3E%40Tom%20Moser%3C%2FA%3E%26nbsp%3B%2C%20any%20chance%20you%20can%20provide%20some%20pointers%20on%20troubleshooting%20this%3F%20Does%20this%20function%20behave%20differently%20in%20the%20MIP%20SDK%3F%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-837497%22%20slang%3D%22en-US%22%3ERe%3A%20Error%20while%20using%20%E2%80%9CIpcCreateLicenseFromTemplateId%E2%80%9D%20function%20in%20RMS%20SDK%202.1%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-837497%22%20slang%3D%22en-US%22%3E%3CP%3E%3CA%20href%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fuser%2Fviewprofilepage%2Fuser-id%2F90352%22%20target%3D%22_blank%22%3E%40Enrique%20Saggese%3C%2FA%3E%26nbsp%3BIt's%20different%20than%20MIP%20SDK.%20I%20don't%20have%20any%20experience%20with%20RMS%20SDK%20to%20be%20very%20helpful%2C%20but%20if%20I%20had%20to%20guess%20I'd%20say%20that%20the%20file%20path%20is%20invalid%20or%20the%20client%20hasn't%20bootstrapped%20and%20downloaded%20templates.%20A%20procmon%20trace%20should%20help%20you%20find%20what%20file%20the%20process%20is%20missing.%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-837784%22%20slang%3D%22en-US%22%3ERe%3A%20Error%20while%20using%20%E2%80%9CIpcCreateLicenseFromTemplateId%E2%80%9D%20function%20in%20RMS%20SDK%202.1%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-837784%22%20slang%3D%22en-US%22%3E%3CA%20href%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fuser%2Fviewprofilepage%2Fuser-id%2F90352%22%20target%3D%22_blank%22%3E%40Enrique%20Saggese%3C%2FA%3EI%20wasn't%20able%20to%20find%20the%20solution%20for%20the%20error%20yet.%20Raised%20a%20request%20with%20Azure%20support.%20They%20have%20sent%20the%20request%20to%20backend%20team%20to%20analyse%20it.%3C%2FLINGO-BODY%3E
Occasional Contributor

Hi,

I am using RMS client 2.1 SDK to apply protection on PDF file.

Client has provided us with template ID.

But when I try to use the function "IpcCreateLicenseFromTemplateId" I get error 

“The System cannot find the file specified. HRESULT: 0x80070002”.

****************************************************************************************

string viewAndPrint = "xxxxx-xxxx-xxx-xxxx-xxxxxxxx";

//Error in thisline

SafeInformationProtectionLicenseHandle handle = SafeNativeMethods.IpcCreateLicenseFromTemplateId(viewAndPrint);

 

SafeNativeMethods.IpcSetLicenseUserRightsList(handle, userRights);

SafeNativeMethods.IpcSetLicenseValidityTime(handle, term);

 

string encryptedFilePath = SafeFileApiNativeMethods.IpcfEncryptFile(
filePath,
handle,
SafeFileApiNativeMethods.EncryptFlags.IPCF_EF_FLAG_KEY_NO_PERSIST,
true,false,true,null,symmetricKeyCred);

****************************************************************************************

Help me solve this error.

 

 

3 Replies

@chandrashekharazad @Tom Moser , any chance you can provide some pointers on troubleshooting this? Does this function behave differently in the MIP SDK?

@Enrique Saggese It's different than MIP SDK. I don't have any experience with RMS SDK to be very helpful, but if I had to guess I'd say that the file path is invalid or the client hasn't bootstrapped and downloaded templates. A procmon trace should help you find what file the process is missing.

@Enrique Saggese I wasn't able to find the solution for the error yet. Raised a request with Azure support. They have sent the request to backend team to analyse it.