If a Python script run is returning an SSL Error like below:
Code Block |
---|
ssl.SSLCertVerificationError: [SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed: unable to get local issuer certificate (_ssl.c:1131) |
it is likely due to the DEV or Production environment certificate not being accepted, then you need to follow the below steps . Follow the steps below to solve it.
firstly Firstly, you need to download the certificates from DEV by visiting https://ws-sandbox.midchains.com:8081/ and prod by visiting and https://ws.midchains.com:8081/using the google chrome browser:
...
a. then click Click on the lock buttonicon :
...
b. and then choose the certificate button which will open the below menuClick on the Certificate button to display the General Information:
...
c. from this menu choose the details Select the Details tab and export each certificate from the Certificate Hierarchy export each certificate one by one:.
...
d. after download After downloading all the certificates rename Builtin Object Token_:Go Daddy Root Certificate Authority - G2 to root and Go Daddy Secure Certificate Authority - G2 to subroot.
...
2. after you downloaded After downloading all certificates, you have to use the command below command in the terminal for every each certificate to make give it in a proper installation format:
Code Block |
---|
sudo openssl x509 -inform DER -in certificate.cer -out certificate.crt |
...
3. Create a directory for extra CA certificates inĀ /usr/share/ca-certificates
using the command below command in the terminal:
Code Block |
---|
sudo mkdir /usr/share/ca-certificates/extra |
...
4. then you have to move Move each certificate to the above directory, using the command below command in the terminal for each certificate:
Code Block |
---|
sudo cp root /usr/share/ca-certificates/extra/root.crt |
...
5. the last step is you have to install Install each certificate one by one after the other using the command below command in the terminal :
Code Block |
---|
sudo dpkg-reconfigure ca-certificates |
which will open This opens an interactive window inside in the terminal like below:
choose yes and it will transfer you to the installation menu like below:
...
Press space
Choose Yes as displayed above.
Tap the space bar on the keyboard to select all the certificates in the extra directory like above, and when you select the certificate there should be a star in the . when the certificate is selected, a star symbol * in brackets before the certificate path like below:
Code Block |
---|
[*] extra/root.crt |
after select Select all certificates and hit ok.if the installation succeeded, it will give a response in the terminal that says
...
The following responses will be displayed once installation has successfully completed:
Code Block |
---|
3 added , 0 removed; done |
To do this installation For non-interactivelyinteractive installation, run the command below command in the terminal:
Code Block | ||
---|---|---|
| ||
sudo update-ca-certificates |
and if it succeeded it should give the response belowOnce installation has successfully completed, the following response will be displayed:
Code Block |
---|
3 added , 0 removed; done |