1
我生成了一个公钥和私钥用于加密目的。有一个密码连接到私钥,但我知道我不应该用这种纯文本显示它。解密数据时保护我的RSA私钥密码
我该怎么做才能保护这个密码,所以不会以纯文本显示?
// $data = encrypted data using RSA public key
// $key = the key that came along with the encrypted data
// find private key
$pkeyid = openssl_get_privatekey("file:///path/to/private.pem", "PASSWORD");
// try and decrypt the data using private key
openssl_open($data, $decrypted_data, $key, $pkeyid);
// if all went well, show decrypted data
echo $decrypted_data;
感谢您的评论厄贝沙坦。通过主密钥你是指密码来获得私钥? – bryan
是的,指的是密码。 –