AD RMS SDK 2.1 C# managed API File Stream Encryption


  • Hello Team,

    I  am working with the AD RMS SDK 2.1

    I have Open file stream in to console application and file is located in c drive.

    I am using Method "IpcfEncryptFileStream()" to encrypt the file y file stream.

    The parameter is passed by me as below.

    SafeFileApiNativeMethods.IpcfEncryptFileStream(connStream, filepath, template.TemplateId, SafeFileApiNativeMethods.EncryptFlags.IPCF_EF_FLAG_DEFAULT, ref connOutputStream, null);


    connStream : My File Stream

    fileapath : Physical file path

    template : Template from the RMS server

    Flag : default

    outputstream : i have pass stream.null.

    While running the console i am facing error message "An unexpected error occurred" with error  code "-2147286787".

    Can you guys help me out what should be parameter for method IpcfEncryptFileStream() ? How can i pass the ref outputstream parameter in this method.

    Thank You,

    Dipen Shah

    • Edited by Dipen_Shah Monday, June 18, 2018 9:26 AM
    Monday, June 18, 2018 9:25 AM