CLI program uses a Python library named certifi to manage root certificates. certifi has a list of root certificates. You can add new root certificate information to the list. Perform the following procedure.
-
Start the Python 3 interpreter.
$ python3
Note:Depending on how Python 3 is installed, you need to type only "python" or type the detailed version of Python (python3.4).
-
Enter as follows to show the path for the certificate list file (cacert.pem) in
certifi.
>>>import certifi >>>print(certifi.where())
Example: When running the command on Linux
$ python3 >>>import certifi >>>print(certifi.where()) /usr/lib/python3.4/site-package/certifi/cacert.pem
-
Use a text editor to open the intended root certificate and copy the
content.
Copy the information in the following range.
-----BEGIN CERTIFICATE----- //From here : : : -----END CERTIFICATE----- //Until here
-
Add the copied information to the certificate list file (cacert.pem) in
certifi.
Use a text editor to open the file at the location indicated in step 2. Add the information copied in step 3 at the end of the file.
CAUTION:-
If you update the certifi library, you need to recopy the root certificate.
-
To remove the installed root certificate, delete the contents added to the certificate list file (cacert.pem) in certifi in step 4.
-
This topic describes how to import root certificates when the certifi library in Python is installed using .whl files. If the certifi library is installed using the OS library, you might need to import root certificates using the particular method of your OS.
-