Issue while Signing and Encrypting the PDF Document.

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

  1. #1

    Default Issue while Signing and Encrypting the PDF Document.

    Hello,

    I am developing one component in VC++(MFC) which signs and encrypts the pdf documents.

    When i sign and encrypt pdf document using my component, I am getting following error while opening the document in Adobe Acrobat
    ------------------------------------
    Error during signature verification

    Unexpected byte range values defining scope of signed data.
    Details: The signature byte range is invalid
    ------------------------------------

    But if i open that document in binary mode and calculate the byte range its looking correct.

    The Process for signing and encrypting the PDF document is as follows :

    1)Prepare the PDF document for signing (Add Annotation objects,n0,n2
    layers,create blank signature field,new xref section etc.)

    2)Encrypt the whole document(Password based encryption).

    3)Put the ByteRange values.

    4)Write the signature in blank signature field.

    If i just perform encryption(128 bit RC4 Algorithm) on the pdf document its working fine.Only after adding the signature objects i am getting above error.I think it means something is wrong in signature related objects,but i am not able to recognize the exact problem.

    So what can be the issue?
    Please Help

    Thanks in Advance
    Priyanka
    Priyanka_Paigude@adobeforums.com Guest

  2. Similar Questions and Discussions

    1. Signing and saving a document in Acrobat 8.0
      We would like to bypass the sign and save As dialog which appears when 1. Sign a document 2. click on Sign Is there any way we could acheive this
    2. Programmatically signing a PDF document
      Hi, i'm trying to develop a VB application to add digital signature to a PDF Document. It's going to run on a desktop environment, with full...
    3. PDF document signing form .Net
      Hi, I have to create a .net library that signs pdf documents. Could anyone give me some advice how to achieve this? Any code example or maybe...
    4. Creating Word Document Issue
      Hi all, trying to create word document using following syntax in c# private Word.ApplicationClass oWordApp = new Word.ApplicationClass(); ...
    5. encrypting files with SSH???
      in comp.unix.admin i read: i agree that encrypting once would have better performance than doing so multiple times. that doesn't alter my...
  3. #2

    Default Re: Issue while Signing and Encrypting the PDF Document.

    What signature objects are you adding? the ONLY THING you should be adding is data between < and > for the value of the Contents key.
    Leonard_Rosenthol@adobeforums.com Guest

  4. #3

    Default Re: Issue while Signing and Encrypting the PDF Document.

    In Contents key i am adding hex encoded attached signature(i.e hash of the file and certificate together) ,after encrypting the pdf document and writing the proper values ByteRange array.

    And other objects are like AP dictionary,n0,n2 layers....

    I have developed two separate components for Encryption and Signing.
    They both work properly if do only signing using signing component and only encrypt using encryption component.

    But If i combine them their is a problem.

    Thanks.
    Priyanka_Paigude@adobeforums.com Guest

  5. #4

    Default Re: Issue while Signing and Encrypting the PDF Document.

    You need to add EVERYTHING BEFORE encrypting EXCEPT the actual hex encoded value inside the <>.

    If you'd like to post a sample PDF that fails, we can take a look.
    Leonard_Rosenthol@adobeforums.com Guest

  6. #5

    Default Re: Issue while Signing and Encrypting the PDF Document.

    yes i am doing the same thing. After encrypting the document i am putting the values in ByteRange array and then hex encoded value in Contents key.
    Can u please tell me how can i send u a sample PDF that fails?

    Should i send it to following mail ids :
    [email]member@adobeforums.com[/email]
    [email]adobe.acrobat.sdk@adobeforums.com[/email]
    Priyanka_Paigude@adobeforums.com Guest

  7. #6

    Default Re: Issue while Signing and Encrypting the PDF Document.

    I am sending the Sample Files

    blank.pdf file is a original file
    <http://www.2shared.com/file/4677649/3f341d92/blank.html>

    step 1: I am adding Signing object(without data in Contents<> key) in
    blank.pdf file.
    Output File is Prepared-blank.pdf
    <http://www.2shared.com/file/4677648/48332d04/Prepared-blank.html>

    step 2: Sending Prepared-blank.pdf file for encryption.
    Output File is SignednEncrypted-blank.pdf which is Encrypted and Signed.
    <http://www.2shared.com/file/4677647/d88c3095/SignednEncrypted-blank.html>

    Password for opening SignednEncrypted-blank.pdf is : "a".

    Please help.
    Thanks.
    Priyanka_Paigude@adobeforums.com Guest

  8. #7

    Default Re: Issue while Signing and Encrypting the PDF Document.

    I opened up SignednEncrypted=blank.pdf in Acrobat 9 and it reports that the signature is fine (albeit, I don't have the certificate in my cert store, so it can't verify identity).
    Leonard_Rosenthol@adobeforums.com Guest

  9. #8

    Default Re: Issue while Signing and Encrypting the PDF Document.

    ohh Great..

    Thanks Leonard.
    I don't have Acrobat 9,But i checked in Acrobat 6 and Acrobat 8 its showing cross on signature and then gives error.

    And issue is i have to make it work on Acrobat 6 and Acrobat 8

    so what do i do?
    Priyanka_Paigude@adobeforums.com Guest

  10. #9

    Default Re: Issue while Signing and Encrypting the PDF Document.

    I am surprised that Acrobat 8 and Acrobat 9 are behaving differently in this regard. Let me check it out...My copy of Acrobat 8 flagged the file as "damaged" and so therefore the recreated bytes don't match.

    Acrobat 6, however, is ANCIENT and is no longer supported by Adobe. I can't help you there - other than tell you to not bother and only worry about 8 and 9.
    Leonard_Rosenthol@adobeforums.com Guest

  11. #10

    Default Re: Issue while Signing and Encrypting the PDF Document.

    I checked that file in Acrobat 9 Reader, it is verifying the file properly but not showing any signature details on the document.
    I am able to see the details in signature pane only.

    But if i Encrypt and Sign the file directly using Acrobat8 and open it in Acrobat 9 i am able to see the details on both Signature pane as well as on page.

    In Acrobat 9 are you able to see the signature details on document?
    Priyanka_Paigude@adobeforums.com Guest

  12. #11

    Default Re: Issue while Signing and Encrypting the PDF Document.

    You have a bunch of problems with the PDF itself - it's not the signature anymore. Look at the content streams, object lengths, font data, etc.
    Leonard_Rosenthol@adobeforums.com Guest

  13. #12

    Default Re: Issue while Signing and Encrypting the PDF Document.

    Sorry Leonard but i am not getting what are the exact problems.
    Can you explain it more?

    I am able Sign blank.pdf properly
    <http://www.2shared.com/file/4679666/7d6215b2/Signed-_blank.html>

    And even i can Encrypt blank.pdf properly
    <http://www.2shared.com/file/4679665/e46b4408/Encrypted-blank.html>

    So whats wrong?
    Priyanka_Paigude@adobeforums.com Guest

  14. #13

    Default Re: Issue while Signing and Encrypting the PDF Document.

    Hi Leonard,

    Now I am able to Sign & Encrypt the PDF. My Issue is resolved

    Thanks for your help.
    Priyanka_Paigude@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