Installation and Usage of python openssl Module

  • 2021-08-12 03:12:08
  • OfStack

This site has had such experience, that is, when installing and using django framework, it encountered some modules that could not be used. After checking for a long time, it was found that because of the version problem, it was necessary to recompile and install a module version. This module is the openssl module we are going to talk about today. Let us have a far-sighted view. First, let us master how to install openssl module, so that we can encounter similar problems in the future and solve them effectively.

Step 1: Download the openssl module


wget
tar -zxvf openssl-1.1.1a.tar.gz
cd openssl-1.1.1a

Step 2: Install the openssl module


./config --prefix=/usr/local/openssl
make&& make install

Step 3, Configure


ln -s /usr/local/openssl/include/openssl /usr/include/openssl
ln -s /usr/local/openssl/lib/libssl.so.1.1 /usr/local/lib64/libssl.so
ln -s /usr/local/openssl/bin/openssl /usr/bin/openssl

The installation of openssl module in python has been completed here. If you need to install this module, or encounter such problems when installing Django framework, you can use the above methods to solve them.

Extension of knowledge points in OpenSSL module:

The SSL module defines two objects: Context and Connection.


OpenSSL.SSL.SSLv2_METHOD
OpenSSL.SSL.SSLv3_METHOD
OpenSSL.SSL.SSLv23_METHOD
OpenSSL.SSL.TLSv1_METHOD
OpenSSL.SSL.TLSv1_1_METHOD
OpenSSL.SSL.TLSv1_2_METHOD Use different SSL Method 

OpenSSL.SSL.VERIFY_NONE
OpenSSL.SSL.VERIFY_PEER
OpenSSL.SSL.VERIFY_FAIL_IF_NO_PEER_CERT
 These constants represent the context object's set_verify() Gets or sets the validation mode used by the. 

Related articles: