OpenSSL is popular security library used by a lot of products, applications, vendors. OpenSSL provides libraries for the most of the programming languages. Python is popular programming language too. We can use OpenSSL library in Python applications. In this tutorial we will develop an example application that uses OpenSSL Python Library and bindings.
Install OpenSSL Python Library with Pip
We can use pip
install for all Linux distributions like Ubuntu, Debian, Mint, Kali, Fedora, CentOS, RedHat, etc. . We can also install OpenSSL Python Library in Windows Operating systems Windows 7, Windows 8, Windows 10, Windows Server 2008, Windows Server 2012, Windows Server 2016.
$ pip install pyopenssl

Install OpenSSL Python Library with Ubuntu, Debian, Mint, Kali
We can install OpenSSL python library for deb
or apt
based distributions like below.
$ apt install python3-openssl
Install OpenSSL Python Lıbrary For CentOS, Fedora, RedHat
We can install OpenSSL python libraries for rpm
or yum
or dnf
based distributions like below.
$ yum install python3-pyOpenSSL.noarch
Import OpenSSL
In order to use OpenSSL library in our Python application we should import the OpenSSL library with the import
keyword like below.
from OpenSSL import SSL
Print OpenSSL Library Version
In this example we will print SSL Certificate Paths. SSL Certificate Paths are stored in the attribute _CERTIFICATE_PATH_LOCATIONS
. We will name the python application as testopenssl.py
and put the following code.
from OpenSSL import SSL print SSL._CERTIFICATE_PATH_LOCATIONS
We run our python application like below.
$ python testopenssl.py

Someone is not thinking clearly!
How can anyone install OpenSSL using PIP – when the problem they have is that OpenSSL is not available to PIP on the server?
Ive been having the same issue! I am unable to install openSSL module in python on my windows 10. Ive tried the pip solution and when I verify it using a try, except block, it gives me that the module has not been installed. Can anyone give me any solutions?
I had the same issue as you Miguel, and i fixed it by upgrading pyopenssl with easy_install :
sudo python -m easy_install –upgrade pyOpenSSL
and then restart the terminal