Update:

I was able to get it to work well enough for our situation using iText 1.5
(version where they were using Bouncy Castle capabilities internally vs. the
external libraries as is the case now). Obviously, being new to this and
working off of code samples I find, it is difficult to know if it is an
inherent issue between iText and Bouncy Castle or just my lack of
understanding in how to mold a solution out of the two for my problem.

Oracle's JDeveloper caused me some initial grief in that the editor would
not recognize an external reference to an inner class of another class
(e.g., PdfPKCS7.X509Name), so it made me think I had an issue that turned
out not to be an issue at runtime.

In the end, the code below allows me to extract what I was looking for:

PdfReader mReader = new PdfReader(aUnsignedFileName);
AcroFields mForm = mReader.getAcroFields();
ArrayList mSignatures = mForm.getSignatureNames();
String mName;
for (Iterator i = mSignatures.iterator(); i.hasNext();)
{
    mName = (String)i.next();
    PdfPKCS7 pk = mForm.verifySignature(mName);
    X509Certificate mCertificate = pk.getSigningCertificate();
    PdfPKCS7.X509Name mX509Name = pk.getSubjectFields(mCertificate);
    String cn = mX509Name.getField("CN");
    String o = mX509Name.getField("O");
    String ou = mX509Name.getField("OU");
    String c = mX509Name.getField("C");
    String e = mX509Name.getField("E");
}

Unfortunately, the line "PdfPKCS7 pk = mForm.verifySignature(mName);"
continues to cause issues for me with all version 2 releases of iText. 
Since I still use iText for creating PDF outputs, I am not sure yet if I am
going to run into other formatting or digital signing issues by using a
version from 2006, prior to several significant upgrades.

If anyone has anyother suggestions that would allow me to use a more current
release of iText I would welcome hearing them.
-- 
View this message in context: 
http://www.nabble.com/Error-when-verifying-signature-tp18391044p18413116.html
Sent from the iText - General mailing list archive at Nabble.com.


-------------------------------------------------------------------------
Sponsored by: SourceForge.net Community Choice Awards: VOTE NOW!
Studies have shown that voting for your favorite open source project,
along with a healthy diet, reduces your potential for chronic lameness
and boredom. Vote Now at http://www.sourceforge.net/community/cca08
_______________________________________________
iText-questions mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/itext-questions

Do you like iText?
Buy the iText book: http://www.1t3xt.com/docs/book.php
Or leave a tip: https://tipit.to/itexttipjar

Reply via email to