【发布时间】:2013-07-24 04:16:51
【问题描述】:
我刚刚在我的 pdf 中添加了时间戳。签名有效。时间戳记号也是正确的(我已经检查过了)。但 adobe reader 告诉我 “签名包含嵌入的时间戳,但无法验证”。
AttributeTable unsigned = signerInformation.getUnsignedAttributes();
Hashtable<ASN1ObjectIdentifier, Attribute> unsignedAttrHash = null;
if (unsigned == null) {
unsignedAttrHash = new Hashtable<ASN1ObjectIdentifier, Attribute>();
} else {
unsignedAttrHash = signerInformation.getUnsignedAttributes().toHashtable();
}
unsignedAttrHash.put(PKCSObjectIdentifiers.id_aa_signatureTimeStampToken, signatureTimeStamp);
SignerInformation newSignertInformation = SignerInformation.replaceUnsignedAttributes(si, new AttributeTable(unsignedAttrHash));
我找到this code at stackowerflow. 它有效。这真的是正确的代码。最后我有新的 SignerInformationStore 和新的 CMS 签名数据,像这样
CMSSignedData.replaceSigners(oldCMSSignedData, newSignerStore);
但也许我的 PDF 中缺少某些内容?证书之类的?
【问题讨论】:
-
嗨!我正在努力解决您遇到的同样问题。您能否向我解释一下,您向时间戳服务发送了什么样的数据来检索正确的消息印记?谢谢!
标签: pdf digital-signature bouncycastle pdfbox adobe-reader