Good morning, this the file with the verified digest:
http://www.filefactory.com/file/b3hc38g/n/signed_pdf

i still get the invalid signature error.
I have no specific reason to use the filter you (Michael) mentioned, in fact
i didnt even know i was using it :)
I suppose that in order to use the detached one you mentioned i would have
to use:
PdfSignature dic1 = new PdfSignature(PdfName.ADOBE_PPKLITE,
PdfName.ADBE_PKCS7_DETACHED);


I was just trying this approach but adobe reader says "Signature contains
incorrect, unrecognized, .... ".
sample: http:// http://www.filefactory.com/file/b3hc3h9/n/signed_pdf
which is, i think, because im inserting the signedHash like this:
dic.put(PdfName.CONTENTS, new PdfString(signedHash).setHexWriting(true));


im trying to follow the code here:
http://itextpdf.sourceforge.net/howtosign.html#signextitextsharp2 Source 

a few snippets:
                // Reason and location
                appearance.setReason("Very good reason");
                appearance.setLocation("Great location");
                appearance.setContact("Some sort of contact");
                appearance.setSignDate(new GregorianCalendar());
                 
                PdfSignature dic1 = new PdfSignature(PdfName.ADOBE_PPKLITE,
PdfName.ADBE_PKCS7_DETACHED);
                dic1.setDate(new PdfDate(appearance.getSignDate()));
               
dic1.setName(PdfPKCS7.getSubjectFields((X509Certificate)appearance.getCertChain()[0]).getField("CN"));
                if (appearance.getReason() != null)
                    dic1.setReason(appearance.getReason());
                if (appearance.getLocation() != null)
                    dic1.setLocation(appearance.getLocation());
                appearance.setCryptoDictionary(dic1);
                int csize = 4000;
                HashMap<PdfName, Integer> exc = new HashMap<PdfName, Integer>();
                exc.put(PdfName.CONTENTS, new Integer(csize * 2 + 2));
                appearance.preClose(exc);

....digest method and signing method

                PdfDictionary dic = new PdfDictionary();
                dic.put(PdfName.CONTENTS, new 
PdfString(signedHash).setHexWriting(true));
                appearance.close(dic);

Am i doing something wrong here?

Regards,
Pedro
-- 
View this message in context: 
http://itext-general.2136553.n4.nabble.com/Another-invalid-signature-thread-tp3003710p3010073.html
Sent from the iText - General mailing list archive at Nabble.com.

------------------------------------------------------------------------------
Nokia and AT&T present the 2010 Calling All Innovators-North America contest
Create new apps & games for the Nokia N8 for consumers in  U.S. and Canada
$10 million total in prizes - $4M cash, 500 devices, nearly $6M in marketing
Develop with Nokia Qt SDK, Web Runtime, or Java and Publish to Ovi Store 
http://p.sf.net/sfu/nokia-dev2dev
_______________________________________________
iText-questions mailing list
iText-questions@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/itext-questions

Many questions posted to this list can (and will) be answered with a reference 
to the iText book: http://www.itextpdf.com/book/
Please check the keywords list before you ask for examples: 
http://itextpdf.com/themes/keywords.php

Reply via email to