为什么 openssl_pkey_new() 失败?

2022-01-07 00:00:00 windows openssl xampp php

我对此很陌生.为什么 openssl_pkey_new() 返回 false?

I'm very new to this. Why is openssl_pkey_new() returning false?

我正在使用 XAMPP,并且在 Apahcein 目录下有一个 OpenSSL.

I am using XAMPP and there is a an OpenSSL under the Apahcein directory.

我犯了什么明显的初学者错误?也许是 SSL 配置的问题?

What obvious beginner mistake am I making? Maybe it's a matter of SSL configuration?

我的目标是将两个密钥写入两个文件.

My goal is to write the two keys into two files.

更新:按照建议,我使用了 openssl_error_string() 并显示 error:02001003:system library:fopen:No这样的过程.听起来可能 OpenSSL 没有运行或不在路径中?有什么想法吗?

Update: as suggested, I used openssl_error_string() and it says error:02001003:system library:fopen:No such process. It sounds like maybe OpenSSL isn't running or isn't in the path?? Any ideas?

更新:我把c:xamppphp放入windows路径,这样它就可以找到libeay32.dll并重新启动Apache.

Update: I put c:xamppphp into the windows path, so that it could find libeay32.dlland restarted Apache.

现在我得到error:2006D080:BIOroutines:BIO_new_file:no such file.有什么想法吗?

Now I get error:2006D080:BIO routines:BIO_new_file:no such file. Any ideas?

推荐答案

使用 openssl_error_string() 找出 openssl_pkey_new() 返回 false(或任何其他 OpenSSL 错误)的原因.

Use openssl_error_string() to find out why openssl_pkey_new() is returning false (or any other OpenSSL error).

在您的最新更新之后,OpenSSL 似乎找不到 openssl.cnf 文件,如 此处描述.

After your latest update, it appears that OpenSSL can't find the openssl.cnf file, as described here.

相关文章