我想将时间戳添加到我的 PDF 文档(没有数字签名)。我怎样才能做到这一点?
我可以使用 Itext 进行数字签名(我这里有 TSAClient):
MakeSignature.signDetached(appearance, digest, signature, chain, null, null, tsa, 0, subfilter);
但是没有数字签名如何做类似的事情呢?使用 Bouncy CaSTLe 或 Itext 或 Pdfbox...或与其他库一起使用..
最佳答案
在 iText 中您正在寻找
LtvTimestamp.timestamp(appearance, tsa, signatureName);
另请参阅。 JavaDoc 文档:
/**
* Signs a document with a PAdES-LTV Timestamp. The document is closed at the end.
* @param sap the signature appearance
* @param tsa the timestamp generator
* @param signatureName the signature name or null to have a name generated
* automatically
* @throws DocumentException
* @throws IOException
* @throws GeneralSecurityException
*/
您可能需要阅读 Digital Signatures for PDF documents 中的第 5.4.1 节添加文档安全存储 (DSS) 和文档级时间戳以便在上下文中使用。
请注意,旧的 PDF 查看器无法正确识别文档级时间戳,因为他们最近才进入 PDF 世界,即 PAdES-4 .
关于java - 如何在没有数字签名的情况下添加时间戳,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/17273958/