1
我想检查给定的PDF文件签名是否存在时间戳。 到目前为止,我来到这个代码:使用iText检查时间戳2.1.7
RandomAccessFileOrArray random =
new RandomAccessFileOrArray(new File("temp.pdf").getAbsolutePath());
PdfReader reader = new PdfReader(random, null);
AcroFields af = reader.getAcroFields();
ArrayList<?> names = af.getSignatureNames();
//this are the signatures?
for (Object o : names){
AcroFields.Item item = (Item) af.getFields().get((String)o);
//this is the class for verifying the signature,
//how do I get it from the item?
PdfPKCS7 pdfPKCS7 = null; //XYZ ???
Calendar signingDate = pdfPKCS7.getTimeStampDate();
}
我显然已取得了签名,但我应该得到PdfPKCS7类验证签名。有谁知道我怎么去那里?
我以前有过这个解决方案,但它不会编译。我下载了itext版本,发现af.verifySignature(name)起作用。这是我修改过的第三方版本。谢谢。 – mrcaramori 2013-03-06 14:12:40