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 =)



Diego Azevedo
E-SEC Seguran├ža Digital
www.esec.com.br <http://www.esec.com.br>
+55 61 3323-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 ;)


2016-10-18 13:04 GMT+02:00 Diego Azevedo <dazev...@esec.com.br <mailto:dazev...@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("DigestMethod", COSName.getPDFName("SHA1"));
        //Only MD5 or SHA1... Go with the least worse

        //Now we add DocMDP specific stuff
        COSDictionary transformParameters = new COSDictionary();
        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 :

    2016-10-18 8:49 GMT+02:00 Tilman Hausherr <thaush...@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

    Thank you for your help!

    What's the difference? (See my other answer from today)


    To unsubscribe, e-mail:users-unsubscr...@pdfbox.apache.org
    For additional commands, e-mail:users-h...@pdfbox.apache.org 

Reply via email to