How To Install and Use OpenSSL Library In Python Applications?
  • Post category:Linux
  • Post comments:0 Comments
  • Post author:
  • Post published:14/04/2021
  • Post last modified:14/04/2021

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 Lıbrary with Pip
Install OpenSSL Python Lıbrary with Pip

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 and put the following code.

from OpenSSL import SSL 

We run our python application like below.

$ python
Print OpenSSL Library Version
Print OpenSSL Library Version

LEARN MORE  How To Convert Python String To Int?

Leave a Reply