Rafael Gomez created PDFBOX-3011:
------------------------------------

             Summary: Find out why trunk CreateVisibleSignature example 
produces incorrect output pdf
                 Key: PDFBOX-3011
                 URL: https://issues.apache.org/jira/browse/PDFBOX-3011
             Project: PDFBox
          Issue Type: Task
          Components: Signing
    Affects Versions: 2.0.0
         Environment: OS X Yosemite on MBP 2,6 GHz Intel Core i7, 16 GB 1600 
Mhz DDR3 
java version "1.7.0_45"
Java(TM) SE Runtime Environment (build 1.7.0_45-b18)
Java HotSpot(TM) 64-Bit Server VM (build 24.45-b08, mixed mode)
            Reporter: Rafael Gomez
            Priority: Trivial
             Fix For: 2.0.0


To evaluate Apache's PDFBox library, I created a simple sample based on trunk 
CreateVisibleSignature and CreateSignature. The reason for combining those 2 
samples was that each provided features that I wanted to test. The created 
"mix" example is in SignPDFPoC.java.

The initial problem I faced is related to the sentence closing the 
SignatureOptions right before calling saveIncremental on the relevant document 
object. Once I moved the 'options.close()' sentence to a better position, 
SignPDFPoC started to produce correct output, signed, pdf files. And once I 
added my test certificate chain to the trusted identities, the signature 
validates correctly.

After examining the produced, signed, pdf, both via Signature Panel on Adobe 
Reader and via the file itself (binary), I got stuck on "Field: Signature1". I 
initially supposed that PDVisibleSignDesigner.signatureFieldName was used for 
that purpose. But it does not seem to be the case. Moreover, for invisible 
signatures, no PDVisibleSignDesigner is used, so there must be a different way.

So I decided to build and execute the original CreateVisibleSignature from 
trunk to check whether it did something different regarding "Field: Signature1" 
that I could have missed in my "mix" example. This is how I found out that the 
trunk CreateVisibleSignature example produces incorrect pdf files. Or I must be 
doing something terribly wrong that, in advanced, I apologize for.

I attach complete zip files for reproducing the observation:
- mix_example_correct_signed_pdf
- trunk_createvisiblesignature_example_incorrect_signed_pdf

Simply add the .zip suffix, unpack and run the corresponding _execute.sh 
script. There are already .class files available. The needed dependencies are 
also present. As test p12 containing a certificate chain, test pdf file and 
test image.





--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to