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
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
dnf based distributions like below.
$ yum install python3-pyOpenSSL.noarch
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