openssl验证错误:num = 20:无法获取本地颁发者证书

时间:2018-07-04 17:54:55

标签: python ssl openssl

我知道这个问题已经有很多答案了,但是我已经尝试了一切,但仍然无法解决这个问题。我只是想为我的本地主机工作获取一个https。任何帮助/提示将不胜感激,谢谢!

我正在运行python 2.7和OpenSSL 1.1.0f和MacOS 10.13 High Sierra。

我尝试过的/知道的:

  • 我在钥匙串访问中标记了我的自签名根证书 一如既往地信任。
  • 从我的阅读中,我理解错误20表示它找不到我的根证书,但是它在我的钥匙串访问中,因此我不确定自己在哪里丢失
  • 我还阅读了有关/etc/ca-certificates.conf的信息,并确保证书在其中,我已经检查过并且没有,但是我尝试将其放在那里并更新ca-certificates及其它也没有工作。据我了解,在根目录访问中拥有我的根CA应该足够了吗?
    • 基本上我在钥匙串中有我自己签名的根证书,在我的python文件中有我的密钥和证书,但是当我卷曲本地主机时,我会收到 curl: (60) SSL certificate problem: unable to get local issuer certificate

我也尝试了所有这些方法,并且得到相同的输出:

openssl s_client -connect localhost:5000

openssl s_client -connect localhost:5000 -CAfile rootCA.pem

openssl s_client -connect localhost:5000 -CApath /etc/ssl/certs/

输出:

openssl s_client -CApath /etc/ssl/certs/ -connect localhost:5000
CONNECTED(00000003)
depth=0 C = US, ST = California, L = San Fran, O = My org, OU = My unit, CN = localhost
verify error:num=20:unable to get local issuer certificate
verify return:1
depth=0 C = US, ST = California, L = San Fran, O = My org, OU = My unit, CN = localhost
verify error:num=21:unable to verify the first certificate
verify return:1
---
Certificate chain
 0 s:/C=US/ST=California/L=San Fran/O=My org/OU=My unit/CN=localhost
   i:/C=US/ST=California/L=San Fran/O=My org/OU=My unit/CN=localhost
---
Server certificate
-----BEGIN CERTIFICATE-----
certificate stuff...
-----END CERTIFICATE-----
subject=/C=US/ST=California/L=San Fran/O=My org/OU=My unit/CN=localhost
issuer=/C=US/ST=California/L=San Fran/O=My org/OU=My unit/CN=localhost
---
No client certificate CA names sent
Peer signing digest: SHA512
Server Temp Key: X25519, 253 bits
---
.
.
.
. other info....

    Start Time: 1530725381
    Timeout   : 7200 (sec)
    Verify return code: 21 (unable to verify the first certificate)
    Extended master secret: yes

0 个答案:

没有答案