简体   繁体   English

PHP中的数字签名

[英]Digital signature in PHP

Could someone please explain how to implement a "digital signature" in PHP. 有人可以解释一下如何在PHP中实现“数字签名”。 I've tried hard to find an answer myself, but have had little success so far. 我一直在努力寻找答案,但到目前为止收效甚微。

I'll give you a pro-forma answer since you have an overly unspecific inquiry anyway: 无论如何,我都会给您一个形式上的答案,因为您的查询过于具体:

file_put_contents("/tmp/document", $text);
exec("gpg --clearsign /tmp/document");
$signed_text = file_get_contents("/tmp/document.asc");

Usually you want to add a --keyring option too. 通常,您也想添加--keyring选项。 For more complex operations you can use the PHP extension for GPG as shown in this article: http://devzone.zend.com/article/3753 对于更复杂的操作,您可以使用GPG的PHP扩展,如本文所示: http : //devzone.zend.com/article/3753

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM