Avatar

Level 1

Hello Steve,

  Appreciate your quick response.

  1. Thank you so much for your reply. I have changed the Welcome Text, Username label and Password label by visiting Display Option under the Rights Management Server Configuration.

  2.  I have used Encryption Service & Rrights Management Service in order to apply the password on a PDF file. At first, I have used the following code to apply the policy which does not include the Authentication:

        Dim rmclient As New RightsManagementService.RightsManagementServiceService

        rmclient.Credentials = New System.Net.NetworkCredential("MyUsername", "MyPassword")

        Dim inDoc As New RightsManagementService.BLOB()
        Dim fs As New FileStream(Server.MapPath("Docs1115.pdf"), FileMode.Open)
        Dim len As Integer = fs.Length()
        Dim byteArray As Byte() = New Byte(len) {}

        fs.Read(byteArray, 0, len)
        inDoc.binaryData = byteArray

        Dim findPolicy As RightsManagementService.PolicySpec = rmclient.getPolicy("DevelopmentPolicySet", "DevelopmentPolicy")

        Dim outBytes As Byte() = rmclient.applyPolicyByPolicyId(inDoc, "Docs1115.pdf", findPolicy.policyId, Nothing, Nothing).binaryData
        Dim fsOut As New FileStream(Server.MapPath("PPDF1_Docs1115.pdf"), FileMode.OpenOrCreate)
        Dim objBinary As New BinaryWriter(fsOut)

        objBinary.Write(outBytes)

        fs.Close()
        fsOut.Close()

  I could not able to do that and hence, has to use the above code for Encryption Service in order to achieve that and here is code for that:

        Dim eClient As New EncryptionService.EncryptionServiceService

        eClient.Credentials = New System.Net.NetworkCredential("MyUsername", "MyPassword")

        Dim inDoc As New EncryptionService.BLOB()
        Dim fsIn As New FileStream(Server.MapPath("Docs2132.pdf"), FileMode.Open)
        Dim len As Integer = fsIn.Length()
        Dim byteArray As Byte() = New Byte(len) {}
        Dim outBytes As Byte() = New Byte() {}

        fsIn.Read(byteArray, 0, len)
        inDoc.binaryData = byteArray

        Dim passSpec As New EncryptionService.PasswordEncryptionOptionSpec()

        passSpec.encryptOption = EncryptionService.PasswordEncryptionOption.ALL
        passSpec.compatability = EncryptionService.PasswordEncryptionCompatability.ACRO_7
        passSpec.documentOpenPassword = "documentOpen"
        passSpec.permissionPassword = "permission"

        Dim outDoc As EncryptionService.BLOB = eClient.encryptPDFUsingPassword(inDoc, passSpec)

        Response.Redirect(outDoc.remoteURL)

  For some reason, I cannot get any Binary Data for outDoc BLOB variable! Hence, I have to redirect the page to the remoteURL and I am getting following screen for authentication which has randomly created filename! :

 

  To avoid this random one and to achieve the real athentication dialog box, I had this question.

  How can I apply authentication with the help of Rights Management Web Service?

  3. I want to validate the user against my database and do not want to have 100,000+ users in Rights Management Server. I have a custom Web Service to do so and wanted to know how can I do that on submission?