0深度查找时出现Mac错误20:无法获取本地颁发者证书

时间:2018-10-06 14:30:12

标签: python macos openssl certificate

我正在编写一个Python程序,以通过Websocket与Qlik感测服务器通信。通过证书进行连接。当我尝试连接时,我收到一条错误消息,提示“无法获取本地发行者证书”。我尝试缩小问题范围,并尝试使用openssl验证证书时收到相同的错误消息。

操作系统:Mac

注意:我已经将root.pem证书安装到系统中并使其受信任。仍然抛出相同的错误消息。

OpenSSL> verify -CAfile root.pem client.pem
client.pem: OK
OpenSSL> 
OpenSSL> verify client.pem
client.pem: CN = QlikClient
error 20 at 0 depth lookup:unable to get local issuer certificate
error in verify
OpenSSL> 

万一有人看

senseHost = “SERVER”
privateKeyPath = "/Users/abc/”


## userDirectory and userId can be found at QMC -> Users
userDirectory, userId = “DIR”, “user”

url = "wss://" + senseHost + “:999/app"  # valid
certs = ({"ca_certs": privateKeyPath + "root.pem",
          "certfile": privateKeyPath + "client.pem",
          "keyfile": privateKeyPath + "client_key.pem",
          "cert_reqs": ssl.CERT_REQUIRED,
          "server_side": False
          })
ssl.match_hostname = lambda cert, hostname: True
ws = create_connection(url, sslopt=certs,
                       header={'X-Qlik-User: UserDirectory=%s; UserId=%s' % (userDirectory, userId)})

0 个答案:

没有答案