pdfbox-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Diego Azevedo <dazev...@esec.com.br>
Subject Re: How to certify a PDF
Date Tue, 18 Oct 2016 15:40:07 GMT
No, but in my case it would never happen, because my certificate is 
trusted for signing, but not certifying:

Image: http://imgur.com/XYZCB8H

[]'s

Diego Azevedo

On 18/10/2016 13:30, Damien Butaye wrote:
> One last question, have you got the "blue ribbon" on the top the pdf 
> when you open it with Acrobat? In my case not, although it is well 
> certified as shown in the Acrobat Signature Panel.
>
>
>
> 2016-10-18 15:58 GMT+02:00 Damien Butaye <damien.butaye@gmail.com 
> <mailto:damien.butaye@gmail.com>>:
>
>     Nice! Thank you very much!
>
>     (Btw, it could be nice to integrate  in a future release a method
>     certify() in the PDSignature object).
>
>     obrigado!
>
>     2016-10-18 15:42 GMT+02:00 Diego Azevedo <dazevedo@esec.com.br
>     <mailto:dazevedo@esec.com.br>>:
>
>         Hello Damien,
>
>         I made a typo:
>
>             dictionary.setItem("Reference", reference_*s*_); // Add
>             Array to Signature dictionary
>
>         There is no point in creating the array, add the "SigRef"
>         dictionary to it... and not use the array on the "Sig"
>         dictionary.  So... just add the 'S' to the variable and re-run
>         it. Just tested here, and it worked fine =)
>
>         []'s
>
>
>         -- 
>         *_______________________________________________
>
>         Diego Azevedo
>         Developer
>         E-SEC Seguran├ža Digital
>         www.esec.com.br <http://www.esec.com.br>
>         +55 61 3323-4410 <tel:%2B55%2061%203323-4410>*
>
>
>         On 18/10/2016 10:21, Damien Butaye wrote:
>>         Hello Diego,
>>
>>          Thank you for your help. I just tried your code but it seems
>>         that it doesn't work. The result has nor signature nor
>>         certify element. I'll try again.
>>         If you have any idea, don't hesitate ;)
>>
>>         Damien.
>>
>>         2016-10-18 13:04 GMT+02:00 Diego Azevedo
>>         <dazevedo@esec.com.br <mailto:dazevedo@esec.com.br>>:
>>
>>             From what I'm reading on ISO 32000, the certification
>>             Signature is a normal signature, but with a DocMDP
>>             transform method. So the ou should do something like this:
>>
>>                 PDSignature signature = new PDSignature;
>>                 [..] //do your thing
>>                 COSDictinary dictionary = signature.getCOSObject();
>>
>>                 //Create a reference dictionary
>>                 COSDictionary reference = new COSDictionary();
>>                 reference.setItem("Type", COSName.getPDFName("SigRef"));
>>                 reference.setItem("TransformMethod",
>>                 COSName.getPDFName("DocMDP"));
>>                 reference.setItem("DigestMethod",
>>                 COSName.getPDFName("SHA1")); //Only MD5 or SHA1... Go
>>                 with the least worse
>>
>>                 //Now we add DocMDP specific stuff
>>                 COSDictionary transformParameters = new COSDictionary();
>>                 transformParameters.setItem("Type",
>>                 COSName.getPDFName("TransformParams"));
>>                 transformParameters.setInteger("P", <1, 2 or 3>); //
>>                 1- no changes permited; 2- fill forms and signing; 3-
>>                 Same as 2 plus annotation creation, deletion an
>>                 modification.
>>                 transformParameters.setItem("V",
>>                 COSName.getPDFName("1.2")); // This is right, it's a
>>                 name, not a number.
>>
>>                 // Add everything in order
>>                 reference.setItem("TransformParams",
>>                 transformParameters ); // Add DocMDP stuff to the
>>                 SigRef Dictionary;
>>                 COSArray references = new COSArray();
>>                 references.add(reference); // Add SigRef Dictionary
>>                 to a Array
>>                 dictionary.setItem("Reference", reference); // Add
>>                 Array to Signature dictionary
>>
>>             I didn't try it myself, just wrote based on PdfBox API
>>             and ISO specification. May have errors.
>>
>>             On 18/10/2016 06:12, Damien Butaye wrote:
>>>             Hello Tilman,
>>>
>>>               Here follows two links explaining the difference :
>>>
>>>
>>>                 1.http://www.investintech.com/resources/articles/certifyingsigningpdf/
>>>             <http://www.investintech.com/resources/articles/certifyingsigningpdf/>
>>>                 2.
>>>                 http://stackoverflow.com/questions/16710439/how-to-add-blank-page-in-digitally-signed-pdf-using-java/16711745#16711745
>>>             <http://stackoverflow.com/questions/16710439/how-to-add-blank-page-in-digitally-signed-pdf-using-java/16711745#16711745>Damien.
>>>             2016-10-18 8:49 GMT+02:00 Tilman Hausherr
>>>             <THausherr@t-online.de> <mailto:THausherr@t-online.de>:
>>>>             Dear all,
>>>>>                 I'm looking for a solution to certify a PDF. Currently
I'm able to
>>>>>             sign a
>>>>>             PDF using PDFBox but I can't certify it. Is-it possible to
do it with
>>>>>             PDFBox?
>>>>>
>>>>>
>>>>>             Thank you for your help!
>>>>>
>>>>             What's the difference? (See my other answer from today)
>>>>
>>>>             Tilman
>>>>
>>>>
>>>>
>>>>             ---------------------------------------------------------------------
>>>>             To unsubscribe, e-mail:users-unsubscribe@pdfbox.apache.org
>>>>             <mailto:users-unsubscribe@pdfbox.apache.org>
>>>>             For additional commands, e-mail:users-help@pdfbox.apache.org
>>>>             <mailto:users-help@pdfbox.apache.org>
>>>>
>>>>

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message