Exit
  • Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
  • 한국 커뮤니티
0

Digital Signature. document changed, invalid signature.

New Here ,
Oct 22, 2021 Oct 22, 2021

Hi, I have a problem when I digitally sign a document in Reader.

Reader states that "the document has changed after signing" but no changes have been made.

I use Reader DC 2021 007 20091 and Windows 10 20H2.

 

Why does Reader say so and state that the signature is invalid?

TOPICS
Security digital signatures and esignatures
15.8K
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Adobe Employee ,
Oct 22, 2021 Oct 22, 2021

Hi there

 

Hope you are doing well and sorry for the trouble. As described, when I digitally sign a document in Reader.  Reader states that "the document has changed after signing.

 

Is this a behavior with a particular PDF file or with all the PDFs that you digitally sign? Please try with a different PDF file and check.  If the file is stored on a shared network drive, please download it to your compouter first and try signing it and check.

 

You may also try to sign the PDF file online via Document Cloud https://documentcloud.adobe.com/link/home/ and see if that helps.

 

Regards

Amal

Regards
Amal
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
Oct 22, 2021 Oct 22, 2021
556 / 5000
 

Översättningsresultat

Hi Amal,
It does not matter if the document is stored locally on my computer or on a network device, I get the same problem with Adobe saying that the document has been modified, with the result that the signature is invalid.
I did not test to sign online because it is not an alternative for me.
I have seen some posts from 2017 about SHA1 and SHA256 and if I change the windows registry so that Adobe will use SHA1, I will not get the error that the document has been changed.
So what is it that makes Adobe think the document has changed if I use SHA256?
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Advocate ,
Oct 24, 2021 Oct 24, 2021

Please share an example PDF before and after signing for analysis.

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Oct 24, 2021 Oct 24, 2021
quote

Please share an example PDF before and after signing for analysis.


By MikelKlink

@Seamountain,

 

Best is not to share a document with confidential or personal information in. I would create a dummy PDF file and a dummy signature!

ABAMBO | Hard- and Software Engineer | Photographer
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Advocate ,
Oct 25, 2021 Oct 25, 2021

Obviously you should not share information on a public forum if you don't want that information to be publicly known.

If you use replacements, though, please do make sure that the issue in question still can be observed with your replacements.

(If you find out that the issue cannot be reproduced with replacement files or certificates, the issue apparently lies within the original file or certificate, so an analysis will require those originals.)

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Advocate ,
Oct 25, 2021 Oct 25, 2021
quote
 
I have seen some posts from 2017 about SHA1 and SHA256 and if I change the windows registry so that Adobe will use SHA1, I will not get the error that the document has been changed.
So what is it that makes Adobe think the document has changed if I use SHA256?

 

Considering this observation it might be relevant which kind of signing device you use. In particular is it some smart card or USB token? There had been smart cards a number of years ago that could not correctly sign SHA256 hashes because these hash values didn't fit in a single data packet and chaining of packets was not supported.

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
Oct 25, 2021 Oct 25, 2021

Hi,

I enclose a document with a signature in Reader where my signature is invalid because the document has been changed or damaged since the signature.
But as you can see, the document contains only my signature.

I have also investigated the problem with SHA 256 and come to the conclusion that my laptop is new so it should be able to read my smartcard, HP Elitebook 840 G6, I also have the latest drive routine for Smartcard.
My smartcard, the client for smartcard and the issuer of the certificate handles SHA256 and if I look at the certificate and the signature, it is made with SHA256.

I have configured Reader to trust publishers that are configured in windows and I have also tried to configure the publishers in directly in Reader, but get the same error.

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Advocate ,
Oct 25, 2021 Oct 25, 2021

 Ok, I have checked the signature.

 In the embedded signature container there are two hash values. That is, there are two hash values that are relevant here; there also are numerous others.

 The first of these hash values is the hash value of the surrounding PDF document. That hash value is correct. Thus, there in particular are no changes to the document at all.

 Now this hash value together with some other important data constitute the "signed attributes". So what actually is signed is this set of attributes. For signing the hash algorithm and the hash value of these attributes is encrypted using the private key of your keypair to be verifiable via decryption using the public key.

 And this second hash value is incorrect in your document!

 I don't know whether during signing Adobe Reader calculates the hash value and forwards only the hash or whether it forwards the whole set of attributes to be hashed by the driver or device, but apparently either during the forwarding or during the hashing an error occurs, so the wrong hash value is signed.

 

 One thing that is noticeable in your signature is that the signed attributes are gigantic, there are about 1.5 MB of them! So maybe some part of the signature generation process (be it Adobe Reader or your card driver or card) is not built for that amount of data.

 Except a handful of bytes these signed attributes are taken up by a single embedded CRL. Thus, I'd propose you switch off embedding of validation information for a test and sign again. The result file should be much smaller, by about 3 MB. If that works, chances are that either indeed some part of the signing process is not up to signing such a large set of signed attributes or that there is a formatting error in the CRL.

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
Oct 25, 2021 Oct 25, 2021

Hi,

Thanks for the reply!
What you write seems logical and I think I found where I turned off the embedding of validation information and the document became very much smaller.

But unfortunately the signature is still invalid with the same error message.

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Engaged ,
Oct 25, 2021 Oct 25, 2021

The document wasn't signed by Acrobat or Reader. The first signature in a document should not be in an incremental save section. 

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
Oct 25, 2021 Oct 25, 2021

Hi,

What do you mean the document is not signed with Adobe or Reader?

I have used Reader's functions for digital signatures but I have used a certificate from another publisher

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Engaged ,
Oct 25, 2021 Oct 25, 2021

The first signature in a document should never be an incremental save. Acrobat and Reader should consolidate all non-signature sections into a single section that is signed. The test document you posted was created by PDFMaker 11.0 as a linearized PDF, which has a small section at the head of the file so that the first page can be rendered while the rest of the file is being loaded. I believe the signing process should de-linearize the file, so that the first signed section is the first section of the file (to the first EOF). In this case, the signature is in an incremental section following the linearized head. My analysis may be incorrect, as its been a few years since I had that code in front of me. Can you try signing with an older version of Reader?

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Advocate ,
Oct 26, 2021 Oct 26, 2021
MikelKlink_0-1635240422909.pngexpand image

The first signature in a document should never be an incremental save. Acrobat and Reader should consolidate all non-signature sections into a single section that is signed.

 

They consolidate incremental updates, but they consolidate into a linearized PDF. At least the current Reader did so in a testrun I just made.

 

There actually is nothing in the format or in the specification that requires the first signature to be in the first document revision. Many PDF signing solutions explicitly apply also the first signature in an incremental update.

 

But indeed, it would be surprising if Adobe Acrobat (Reader) would not consolidate incremental updates from an unsigned original PDF and store the whole file in its own way (which currently appears to be linearized) for signing.

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Advocate ,
Oct 26, 2021 Oct 26, 2021
quote

What you write seems logical and I think I found where I turned off the embedding of validation information and the document became very much smaller.

 

Yes, your new example indeed is without the validation information, without the embedded giant CRL.

 

quote

But unfortunately the signature is still invalid with the same error message.

 

Indeed. The signed hash again is incorrect. So while this simplified the use case, it didn't fix the error.

 

I'm afraid I cannot analyze the issue further without having a similar setup myself, and as I don't have such a Swedish card, that's not possible.

 

I would propose some tests that would allow you to narrow down the possible cause of the issue. But that would be narrowing down only, not solving the issue:

 

  1. Create a self-signed soft-token (using "Create a new Digital ID") with a 2048-bit RSA key and use it to test signing with SHA256. If this doesn't work, something is broken in your Adobe Reader (or operation system crypto routines it may use).
  2. Install Adobe Reader and smart card drivers on a different computer and test with your card.
  3. If you have a different card (by a different manufacturer with a different driver), try signing with that card, too, on both test computers.
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
Oct 26, 2021 Oct 26, 2021

Hi,

Thanks for all the answers!
I must admit that I did not know that PDF files are so advanced and complicated 🙂

I have saved my PDF as a full PDF (I hope), it does not say "Linearized" in the first paragraph when I open files with Notepad.

I have tried to sign the full PDF but unfortunately I still get the same error. I have not found any older version of Reader to test with but I have gained access to Adobe Acrobat and tried to sign the same PDF and it works, the signature is valid.

I do not know if my conclusion is correct but since Acrobat can sign, there "should" be nothing wrong with my set of Smart Card, driver, Smartcard client, OS and so on.
I have also tried to sign the PDF with a Digital ID created in Reader and it also works.

So the problem seems to be related to Reader and when Reader will Hash the signature from my smartacard. So what makes Reader different from Acrobat because it works with Acrobat?

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Advocate ,
Oct 26, 2021 Oct 26, 2021

 Indeed, apparently your Acrobat installation succeeds where your Reader installation fails.

 Maybe some Reader settings are broken (you may try to compare configurations; but the configurations you can view in the Preferences dialog is not complete, much is only in files or the Registry).

 Or maybe the installation is broken (you may try to uninstall and re-install the Reader).

 Have a look at the versions, though! Your Reader has version 2021.007.20091 while your Acrobat has 2020.004.30015. In the worst case a bug found its way into the Reader in the time between which results in the observed behavior...

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Engaged ,
Oct 26, 2021 Oct 26, 2021

There are some theoretical exploits, generally involving invalid objects and misuse of white space, which I have never seen in real life. Rewriting all the unsigned incremental sections (including the linearization section) prevents these exploits (unless you have an evil signing program).

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Advocate ,
Oct 26, 2021 Oct 26, 2021

Well, exploits usually don't need incremental updates, at least not before signing. But rewriting the file indeed gets rid of the dangers by many possible exploits.

Nonetheless, rewriting is not required by the specifications in question, so validators must be good enough to detect all the exploits. Which they aren't yet. But they've gotten much better since https://www.pdf-insecurity.org/ started.

 

And YES to

quote

unless you have an evil signing program.

 

The biggest danger most likely is in trusting unknown programs, in particular unknown remote services, to sign documents using your local smartcard or other sscd.

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Engaged ,
Oct 26, 2021 Oct 26, 2021

Most 3rd party signature validators only check the cryptographic validity of the CMS signature, and may also check the revocation status of the signing certificate. Acrobat, in addition, performs "Document Modification Analysis" to detect changes to content or field values that may cause the signature to be declared invalid due to "document has been altered or corrupted since it has been signed". The CMS signature may be valid. Adobe has not, to my knowledge, documented the internal checks that Acrobat and Reader make to reach that determination. It's more complicated than you might think.

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
Oct 27, 2021 Oct 27, 2021

Hello,

My next step will be to do a new installation of Reader to see if it makes any difference and I keep my fingers crossed that it does.

Are there any special Reader settings I should check? I found a page on Adobe where a lot of Registry keys were described but it is difficult to control something when you do not really know what to control.

I also do not think I use an "evil signing program" as I use the feature found in Reader, and in Pro. It's probably Adobe itself that created that function, so they should do it in a way that they themselves think is okay.

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Advocate ,
Oct 27, 2021 Oct 27, 2021
LATEST

@Seamountain 

 

quote

Are there any special Reader settings I should check? I found a page on Adobe where a lot of Registry keys were described but it is difficult to control something when you do not really know what to control.

 

Unfortunately I've no specific idea as I've not yet had such an issue with the Reader myself. I'd start with a fresh installation on a second computer (or a virtual machine or at least a sandbox), test to sign, and compare settings.

 

quote

I also do not think I use an "evil signing program" as I use the feature found in Reader, and in Pro. It's probably Adobe itself that created that function, so they should do it in a way that they themselves think is okay.

 

Yes, the signing feature of Adobe Acrobat (Reader) should not count as evil.
Theoretically there could be some virus / trojan docked in between your Adobe Reader and your smart card driver replacing your signature requests with signature requests for some fraught documents. But that's not very likely.

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Advocate ,
Oct 27, 2021 Oct 27, 2021
quote

Acrobat, in addition, performs "Document Modification Analysis" to detect changes to content or field values that may cause the signature to be declared invalid due to "document has been altered or corrupted since it has been signed".

 

Yes. Their intial implementation thereof was not really usable outside of Adobe-only software use cases as it required not merely that changes were allowed but also that they were done similar to how Adobe software would have done them (e.g. there apparently was a test checking whether the size of the compressed content stream of an instantiated page template was the same as it would be if Adobe Reader had created it). Meanwhile they appear to have made the checks less Adobe Reader specific. In some cases this led to vulnerabilities, though, some of which have been made public on https://www.pdf-insecurity.org/ and elsewhere.

 

quote

Adobe has not, to my knowledge, documented the internal checks that Acrobat and Reader make to reach that determination.


No, not publicly. And these checks anyways have been changing considerably over time.

In this context the work on ETSI TS 119 102-3 might result in a common, standardized rule set.

 

quote

It's more complicated than you might think.

 

Don't worry, I've done some experiments in that regard and come across a number of pitfalls, so I have a pretty good idea of the complications... 😉

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines