如何使用 .pem 证书签署 pdf 文件?
How to sign a pdf file with a .pem certificate?
我用里面的私钥以自签名的方式生成了一个.pem 证书。我必须在 pdf 文件上应用签名来测试实际检查签名是否无效的代码。
我需要一种在 C# 或 OpenSSL 中执行此操作的方法。
例如,对于 OpenSSL,我尝试使用这个
openssl cms -nosmimecap -md sha256 -binary -nodetach -cades -outform DER -sign -signer miocertificato.pem -inkey miachiaveprivata.key -in filedafirmare.pdf -out fileformato.pdf.p7m
但我遇到了这个错误 "cms: Unrecognized flag cades"。
OpenSSL 无法执行此操作!
在 C# 中,您可以将 PDF 的字节修改为 specified。
或者,您可以在 iText Sharp, as in the question.
等开源软件的基础上构建
或者您可以寻找商业组件 - 它们中的大多数都支持数字签名。
我用里面的私钥以自签名的方式生成了一个.pem 证书。我必须在 pdf 文件上应用签名来测试实际检查签名是否无效的代码。
我需要一种在 C# 或 OpenSSL 中执行此操作的方法。
例如,对于 OpenSSL,我尝试使用这个
openssl cms -nosmimecap -md sha256 -binary -nodetach -cades -outform DER -sign -signer miocertificato.pem -inkey miachiaveprivata.key -in filedafirmare.pdf -out fileformato.pdf.p7m
但我遇到了这个错误 "cms: Unrecognized flag cades"。
OpenSSL 无法执行此操作!
在 C# 中,您可以将 PDF 的字节修改为 specified。
或者,您可以在 iText Sharp, as in the question.
等开源软件的基础上构建或者您可以寻找商业组件 - 它们中的大多数都支持数字签名。