使用Java中的自定义数字签名来签名PDF [英] Sign a Pdf using custom digital signature in Java

查看:281
本文介绍了使用Java中的自定义数字签名来签名PDF的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我已经使用Sun的代码创建了数字签名: http ://download.oracle.com/javase/tutorial/security/apisign/examples/GenSig.java 。如何使用此数字签名对pdf文件签名?也就是说:如何将签名添加到pdf文件中?

I've created a digital signature using Sun's code:http://download.oracle.com/javase/tutorial/security/apisign/examples/GenSig.java. How can I sign a pdf file using this digital signature? That is: how can I add the signature to a pdf file?

推荐答案

您采用了错误的方法。您无法轻松地将签名附加到PDF。 PDF规范包括对数字签名的支持。这些签名被嵌入到文档中,并且它们的计算是不平凡的过程。

You've taken the wrong approach. You can't easily append the signature to the PDF. PDF specification includes support for digital signatures. Those signatures are embedded into the document, and their calculation is a non-trivial process.

您最好的选择是放弃当前的实施方式,例如iText库或我们的 SecureBlackbox 将为您完成这项工作。

Your best bet is to drop your current implementation and take eg. iText library or our SecureBlackbox which will do the job for you.

如果您的任务是自己实现签名,则获取PDF规范,阅读并实现相应的内容(在这种情况下,您的问题过于广泛以至于将以StackOverflow格式回答)。

If your task is to implement signature yourself, then take PDF specification, read it and implement the corresponding pieces of it (and in this case your question is way too broad to be answered in StackOverflow format).

这篇关于使用Java中的自定义数字签名来签名PDF的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆