随着WebCrypto API的发展和Chrome和Firefox的支持,我想用它来对PDF文档进行数字签名.周围没有太多的文献,但我找到了一些例子[1]和一个名为PKI.js的图书馆[2].在示例中,描述了签名过程,但最终返回签名.我希望我的Base64 PDF文件在签名的Base64字符串中再次返回,但遗憾的是,这不是发生的事情.据我所知,PKI.js也没有提供签署我的Base64 PDF的方法.
有没有办法只使用JavaScript和WebCrypto API签署PDF?私钥可以输入<textarea>或甚至更好地存储在浏览器的证书设置中.
Base64 PDF(来自REST API)→使用JS和证书签名→签名Base64 PDF(发送到REST)
关于在 php 中使用 pkcs7 签署电子邮件的文档,我必须使用先前生成的证书。
在 openssl 中准确生成此示例所需文件的命令是什么? http://www.php.net/manual/it/function.openssl-pkcs7-sign.php
<?php
// the message you want to sign so that recipient can be sure it was you that
// sent it
$data = <<<EOD
You have my authorization to spend $10,000 on dinner expenses.
The CEO
EOD;
// save message to file
$fp = fopen("msg.txt", "w");
fwrite($fp, $data);
fclose($fp);
// encrypt it
if (openssl_pkcs7_sign("msg.txt", "signed.txt", "mycert.pem",
array("file://mycert.pem", "mypassphrase"),
array("To" => "joes@example.com", // keyed syntax
"From: HQ <ceo@example.com>", // indexed syntax
"Subject" …Run Code Online (Sandbox Code Playgroud)