openssl_pkey_new在windows php上返回false

时间:2016-12-11 19:29:25

标签: php windows apache xampp php-openssl

我使用的是x64,PHP 7.0.4,Apache 2.4。我正在尝试创建私钥和公钥

$config = array(
    "digest_alg" => "sha512",
    "private_key_bits" => 1024,
    "private_key_type" => OPENSSL_KEYTYPE_RSA,
);

// Create the private and public key
$res = openssl_pkey_new($config);
var_dump(openssl_get_cert_locations());
var_dump(openssl_error_string());exit;

我得到了这个输出

array(8) {
  ["default_cert_file"]=>
  string(36) "c:/openssl-1.0.2e-win32/ssl/cert.pem"
  ["default_cert_file_env"]=>
  string(13) "SSL_CERT_FILE"
  ["default_cert_dir"]=>
  string(33) "c:/openssl-1.0.2e-win32/ssl/certs"
  ["default_cert_dir_env"]=>
  string(12) "SSL_CERT_DIR"
  ["default_private_dir"]=>
  string(35) "c:/openssl-1.0.2e-win32/ssl/private"
  ["default_default_cert_area"]=>
  string(27) "c:/openssl-1.0.2e-win32/ssl"
  ["ini_cafile"]=>
  string(0) ""
  ["ini_capath"]=>
  string(0) ""
}

结果是:

string(51) "error:02001003:system library:fopen:No such process"

我应该在哪个文件中进行更改,哪里可以找到正确的文件和路径?

最好的问候

0 个答案:

没有答案