Encrypt PDF Files - Adobe Acrobat SDK

Ask a Question related to Adobe Acrobat SDK, Design and Development.

  1. #1

    Default Encrypt PDF Files - Adobe Acrobat SDK

    I'm new to using the Acrobat SDK. From what I have read I can use the SDK and related JS Objects to encrypt a selected PDF file and assign a Certificate file to the PDF file to use for encryption.

    Please point me in the right direction on how to get started.

    The application will be Win Forms on .NET 2.0 Framework written in C#

    Thanks,
    Galahad_Phillips@adobeforums.com Guest

  2. Similar Questions and Discussions

    1. Adobe Acrobat Pro and links to text files
      While several operating systems have added support for mime type associations with applications, it appears that links to text files in pdf documents...
    2. Can I encrypt ColdFusion files?
      Can I encrypt ColdFusion files? I'd like to make a CF application with encrypted .CFM pages so purchasers can't see the code. The purchaser...
    3. Applications/Adobe Acrobat 7.0Professional/Adobe Acrobat 7.0Professional.app/Contents/MacOS/Acroba
      Does anyone know what this means. I keep getting the following entry over and over in my "console.log" file: May 9 13:37:07 mycomuter...
    4. Adobe Acrobat 6.0.1 Pro - Unable to open files
      Dear All, I'm running Adobe Acrobat 6.0.1 Pro on Windows XP (with all updates installed). I can open 5 - 10 pdf files and then I'm unable to...
    5. linking Adobe Acrobat files
      I have recently upgraded from Publisher 2000 to Publisher 2003. While I can insert an embedded link to an Adobe Acrobat file in my Publisher...
  3. #2

    Default Re: Encrypt PDF Files - Adobe Acrobat SDK

    Followup: I found the following link that discussing what I want to do accomplish - Encrypt PDF Files With A Certificate.

    <http://livedocs.adobe.com/livecycle/8.2/programLC/programmer/help/wwhelp/wwhimpl/common/html/wwhelp.htm?context=sdkHelp&file=000057.html>

    & This link:

    <http://livedocs.adobe.com/livecycle/8.2/programLC/programmer/help/wwhelp/wwhimpl/common/html/wwhelp.htm?context=sdkHelp&file=000057.html>

    What I don't understand about the second link is what is referred to below:

    Create an Encryption Client API object
    To programmatically perform an Encryption service operation, you must create an Encryption service client. If you are using the Java Encryption Service API, create an EncrytionServiceClient object. If you are using the web service Encryption Service API, create an EncryptionServiceService object.

    Since I'm writing the code in C# can I use either the Java Encryption Service API or the web service? Where do I get those references or get these API's?
    Galahad_Phillips@adobeforums.com Guest

  4. #3

    Default Re: Encrypt PDF Files - Adobe Acrobat SDK

    Are you building a desktop solution or a server solution? If desktop, wWill the user have Adobe Acrobat installed on their computer?
    Leonard_Rosenthol@adobeforums.com Guest

  5. #4

    Default Re: Encrypt PDF Files - Adobe Acrobat SDK

    Thanks for the response. It's a desktop application using Win Forms and C# in .NET 2.0 framework.

    The client wants to use Adobe SDK to do the encryption, however I'm not quite sure how to do that after reviewing the Acrobat SDK.

    The user will have Acrobat installed on their machine.

    The high level requirement is below:

    1. Allow user to select a source directory when PDF file(s) reside.
    2. Allow user to select an output directory for the PDF file(s) to be copied to once they are encypted.
    3. Allow user the ability to select a certificate file (.cer,.pfx) and then use that certificate to encrypt the file(s) from the source directory.

    Thx so much for your response, this is new territory for me :)
    Galahad_Phillips@adobeforums.com Guest

  6. #5

    Default Re: Encrypt PDF Files - Adobe Acrobat SDK

    I found one other thread on this subject where the requirement was to encrypt a PDF file w/ a cert.

    See below:
    <http://www.adobeforums.com/.3c05eda1/3>

    Lots of references there to the Javascript SDK...to make sure I have the right one, I downloaded it from here:
    <http://www.adobe.com/cfusion/entitlement/index.cfm?e=acrobat%5Fsdk>

    I'm reading thru the js_developer_guide.pdf to see how encryption is supposed to work. There's a section titled Security and a sub section called Encrypting files using certificates.

    I see on p 178 of this doc about creating a new self sign digital ID. I'm wondering if code in this section can be modified to encrypt the document w/ a user selected cert instead of creating on on the fly?
    Galahad_Phillips@adobeforums.com Guest

  7. #6

    Default Re: Encrypt PDF Files - Adobe Acrobat SDK

    Yes. In the same sample, set bUI to true on the handler.login call and the user should be presented with an interface to select their certificate.
    PDL@adobeforums.com Guest

  8. #7

    Default Re: Encrypt PDF Files - Adobe Acrobat SDK

    Ok, that makes sense. So now that generates a few questions :)

    See below:

    1. In reading the JS Developer Guide, I don't see anythign stating where the server side JS libraries are located or how I include them for example in my Win Forms project.

    2. In the sample I believe I see the handler.login call:
    var ppklite = security.getHandler("Adobe.PPKLite");
    Then the last line that creates the user certs:
    bUI: false.

    What does the var bUI refer to? Showing a JS interface to the user? I was simply planning on giving the user a browse option in my Win Forms to select the cert from a Windows dir?

    Am I headed in the right direction?

    Thanks again!
    Galahad_Phillips@adobeforums.com Guest

  9. #8

    Default Re: Encrypt PDF Files - Adobe Acrobat SDK

    Ok I'm making progress I think :)

    The following code should encrypt the pdf file hopefully, however once I execute this code and then open the PDF file, it opens fine:

    AFormApp formApp;
    CAcroAVDoc doc;
    Fields fields;
    string nVersion;
    string menuItem = string.Empty;
    string certPwd = string.Empty;
    string jsCode = string.Empty;

    //open pdf
    doc = (CAcroAVDoc)Interaction.CreateObject("AcroExch.AVD oc", "");
    doc.Open(fileName, "Test PDF");

    //acrobat form object
    formApp = (AFormApp)Interaction.CreateObject("AFormAut.App", "");

    //access some object property in objects inside AcroForm.
    fields = (Fields)formApp.Fields;

    certPwd = "test";
    menuItem = "ADBESDK:AddSignature";
    jsCode = "SetUserPassword(" + "'" + certPwd + "'); SetUserDigitalIDPath(" + "'" + certPath + "');" + "app.execMenuItem(" + "'" + menuItem + "');";

    fields.ExecuteThisJavascript(jsCode);
    doc.Close(0);

    I created this code based on a sample from the SDK project called FillFormCS.

    There's a section in there that contains the following comment:

    /************************************************** ****
    VB code in an Acrobat IAC program
    to sign a PDF quietly ( no Acrobat running on screen ),
    using the JS methods in this file
    * ************************************************** ***

    When signing a PDF file is referred to, is in the context of encrypting it with a certificate? Or is it referring to a different kind of signature? Are there any changes I have to make to existing PDF's to encrypt them with a cert?

    Thx again!
    Galahad_Phillips@adobeforums.com Guest

  10. #9

    Default Re: Encrypt PDF Files - Adobe Acrobat SDK

    So follow up to my last post, the sample I was using just signs the file w/ a digital id, not actually encrypting the file from what I can tell.

    So the research continues...
    Galahad_Phillips@adobeforums.com Guest

  11. #10

    Default Re: Encrypt PDF Files - Adobe Acrobat SDK

    So after more research, it looks like the only way to encrypt a PDF doc is by using the encryptForRecipients method noted on page 171.

    According to the documentation, this method encrypts the document using the public key certs of each recipient.

    So basically I have to use ADSI to connect to the directory containing user certs and encrypt the doc for a list of groups.

    Can I bypass the ADSI part and just specify a static location for the .cer file and then use the encryptForRecipients method?

    Also I'm using the ExecuteThisJavascript method of the Fields object from the AFormApp class.

    Does the ExecuteThisJavascript method run the js code against the PDF file?

    It seems I'm very close to getting this working.
    Galahad_Phillips@adobeforums.com Guest

  12. #11

    Default Re: Encrypt PDF Files - Adobe Acrobat SDK

    As I'm trying to get this code working I decided to start out slow w/ just one line of js code:

    jsCode.Append("var sh = security.getHandler('Adobe.PPKMS');" + Environment.NewLine);

    After the code is executed in my Win Form, the file opens and see the following error in the script debugger:

    NotAllowedError: Security settings prevent access to this property or method.
    Security.getHandler:1:External undefined:Exec

    Any ideas on this one?
    Galahad_Phillips@adobeforums.com Guest

  13. #12

    Default Re: Encrypt PDF Files - Adobe Acrobat SDK

    Put your JS in a folder-level JavaScript file, inside a function that raises the privilege level with app.beingPriv/app.endPriv, and then call that function from your IAC app.
    PDL@adobeforums.com Guest

Posting Permissions

  • You may not post new threads
  • You may post replies
  • You may not post attachments
  • You may not edit your posts

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139