2
我需要使用SHA1RSA对数字签名进行数字签名,我该怎么做?如何在PHP中对请求数据进行数字签名
class MyEncryption
{
public $pubkey = '...public key here...';
public function encrypt($data)
{
if (openssl_public_encrypt($data, $encrypted, $this->pubkey))
$data = base64_encode($encrypted);
else
throw new Exception('Unable to encrypt data. Perhaps it is bigger than the key size?');
return $data;
}
}
是不是应该与服务器共享您的RSA密钥?如果密钥的任何部分都不共享,那么有问题的服务器如何验证某个事物是否确实已签名,因为它无法计算出相同的结果? –
我更新了上面的问题。谢谢 – PHP