Php 未生成RSA私钥
我是PHP新手,我学习了本教程 使用下面的代码,在我的根文件夹中没有生成private.key文件。有什么不对劲吗?我在Windows 10上运行XAMPP,并且我已将环境变量设置为指向我的XAMPP的openssl.cnf文件Php 未生成RSA私钥,php,openssl,rsa,Php,Openssl,Rsa,我是PHP新手,我学习了本教程 使用下面的代码,在我的根文件夹中没有生成private.key文件。有什么不对劲吗?我在Windows 10上运行XAMPP,并且我已将环境变量设置为指向我的XAMPP的openssl.cnf文件 function generate_public_private_keys() { $privateKey = openssl_pkey_new(array( 'private_key_bits' => 2048, // Siz
function generate_public_private_keys() {
$privateKey = openssl_pkey_new(array(
'private_key_bits' => 2048, // Size of Key.
'private_key_type' => OPENSSL_KEYTYPE_RSA,
));
// Save the private key to private.key file. Never share this file with anyone.
openssl_pkey_export_to_file($privateKey, 'private.key');
// Generate the public key for the private key
$a_key = openssl_pkey_get_details($privateKey);
// Save the public key in public.key file. Send this file to the person developing the ticket scanner app
file_put_contents('public.key', $a_key['key']);
// Free the private Key.
openssl_free_key($privateKey);
}
尝试在Xampp文件夹下查找,如C:\Xampp尝试在Xampp文件夹下查找,如C:\Xampp