Opening a SSL socket connection in Python

前端 未结 4 1874
予麋鹿
予麋鹿 2020-11-27 12:30

I\'m trying to establish a secure socket connection in Python, and i\'m having a hard time with the SSL bit of it. I\'ve found some code examples of how to establish a conn

4条回答
  •  野性不改
    2020-11-27 12:32

    There is a lot of fun to be had solving these problems but for me, I found that the underlying infrastructure for python ssl is openssl. Try validating your certificates with openssl and do this before you try to get python to use that same stack.

    I needed to import a root certificate into openssl before I could validate the leaf certificate.

    This was helpful.
    http://gagravarr.org/writing/openssl-certs/others.shtml#ca-openssl

    Another interesting thing was that two different build of the same version of python on different hosts had different methods. One had ssl.get_default_verify_paths() and the other didn't had any at all. The lesson here is that python ssl is built on openssl. Different underlying libraries give you a different python.

    Python SSL is built on openssl so solve certificate issues in openssl first.

提交回复
热议问题