如何使用itext在PDF签名外观中显示时间戳状态

如何使用itext在PDF签名外观中显示时间戳状态,pdf,itext,Pdf,Itext,adobe reader显示pdf签名状态,有效和无效 我希望读者能够显示签名中包含的动态(而非静态)时间戳状态 我使用的itext代码如下所示 PdfReader reader = new PdfReader(IN_FILE); FileOutputStream fout = new FileOutputStream(OUT_FILE); PdfStamper stp = PdfStamper.createSignature(reader, fout, '\0'); PdfSignatureA

adobe reader显示pdf签名状态,有效和无效

我希望读者能够显示签名中包含的动态(而非静态)时间戳状态

我使用的itext代码如下所示

PdfReader reader = new PdfReader(IN_FILE);
FileOutputStream fout = new FileOutputStream(OUT_FILE);
PdfStamper stp = PdfStamper.createSignature(reader, fout, '\0');
PdfSignatureAppearance sap = stp.getSignatureAppearance();

sap.setCrypto(null, chain, null, PdfSignatureAppearance.SELF_SIGNED);

sap.setVisibleSignature(new Rectangle(100, 100, 300, 200), 1, "Signature");

PdfSignature dic = new PdfSignature(PdfName.ADOBE_PPKLITE, new PdfName("adbe.pkcs7.detached"));
dic.setReason(sap.getReason());
dic.setLocation(sap.getLocation());
dic.setContact(sap.getContact());
dic.setDate(new PdfDate(sap.getSignDate()));
sap.setCryptoDictionary(dic);

int contentEstimated = 15000;
HashMap exc = new HashMap();
exc.put(PdfName.CONTENTS, new Integer(contentEstimated * 2 + 2));
sap.preClose(exc);
PDFTemplate sigLayer=PdfSignatureAppearance.getLayer(n)


负责签名外观。但是我无法包含动态时间戳状态。

待签名时间戳哈希值是在创建文档的签名外观时,在已签名的pdf上计算的

修改pdf添加ts信息将使签名无效