Ok, everything works now.
It looks like a problem of OpenSignPDF... this is what they do:
        [CUT]
        PdfDictionary signDict = new PdfDictionary();
        signDict.put(PdfName.FT, PdfName.SIG);
        signDict.put(PdfName.FILTER, new PdfName("Adobe.PPKLite"));
        signDict.put(PdfName.SUBFILTER, new PdfName("adbe.pkcs7.detached"));
        signDict.put(PdfName.M, new PdfDate(cal));
        signDict.put(PdfName.NAME, new
PdfString(PdfPKCS7.getSubjectFields((X509Certificate)
certChain[0]).getField("CN")));

        PdfDictionary transParamsDict = new PdfDictionary();
        transParamsDict.put(PdfName.P, new PdfNumber(1));
        transParamsDict.put(PdfName.V, new PdfName("1.2"));
        transParamsDict.put(PdfName.TYPE, new PdfName("TransformParams"));

        PdfDictionary refDict = new PdfDictionary();
        refDict.put(new PdfName("TransformMethod"), new PdfName("DocMDP"));
        refDict.put(PdfName.TYPE, new PdfName("SigRef"));
        refDict.put(new PdfName("TransformParams"), transParamsDict);

        PdfArray typesArray = new PdfArray();
        typesArray.add(refDict);

        signDict.put(new PdfName("Reference"), typesArray);
        signApp.setCryptoDictionary(signDict);
        [CUT]

I have changed it into:

        PdfDictionary signDict = new PdfDictionary();
        signDict.put(PdfName.FT, PdfName.SIG);
        signDict.put(PdfName.FILTER, new PdfName("Adobe.PPKLite"));
        signDict.put(PdfName.SUBFILTER, new PdfName("adbe.pkcs7.detached"));
        signDict.put(PdfName.M, new PdfDate(cal));
        signDict.put(PdfName.NAME, new
PdfString(PdfPKCS7.getSubjectFields((X509Certificate)
certChain[0]).getField("CN")));
        signApp.setCryptoDictionary(signDict);

and now it works fine. It looks like they were adding unecessary fields
(maybe because they are using an old version of iText).

Thank you,
  Luca


On Dec 9, 2007 10:42 PM, Luca Tomat <[EMAIL PROTECTED]> wrote:

> Hello,
> i'm trying to place multiple signatures on a PDF file (i need 4
> signatures).
> I tried modifying OpenSignPDF but when i add more than two signatures i
> always get that only the first and the last one are valid while all the
> signatures among the two show a red X on them.
>
> For instance... lets say that i have 3 signatures, then the first and
> third signature are valid, but not the second. Same thing if i have 4
> signatures: the first and fourth signature are valid but not the second and
> the third.
-------------------------------------------------------------------------
SF.Net email is sponsored by:
Check out the new SourceForge.net Marketplace.
It's the best place to buy or sell services for
just about anything Open Source.
http://sourceforge.net/services/buy/index.php
_______________________________________________
iText-questions mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/itext-questions
Buy the iText book: http://itext.ugent.be/itext-in-action/

Reply via email to