首先要使用openssl提供的函数,PHP需要此扩展:
编译时加上此配置即可:–with-openssl=/path/to/ssl
首先看看如何对数据进行签名:
这里我们学习到了三个openssl的方法:
openssl_pkey_get_private ( mixed $key [, string $passphrase = “” ] ) 此方法用于加载私钥。
$key接受的参数可以是私钥文件(协议+文件路径)或者私钥的内容。如上面代码里的方式是后者,如果换成第一种方式则是:
privatekey=opensslpkeygetprivate(“file://privatekey = openssl_pkey_get_private(“file://privatekey=opensslpkey