import base64
import ssl
certificate_file = "s2s-prod.cer"
certificate_secret = "UEbQ67AubZBK"
context = ssl.SSLContext()
context.load_cert_chain(certfile=certificate_file, password=certificate_secret)
When I try to run the code, I have this error: SSLError: [SSL] PEM lib (_ssl.c:4045)
. I decided to check the file _ssl.c
on line 4045 to see what is this error.
if (capath && !PyUnicode_FSConverter(capath, &capath_bytes)) {
if (PyErr_ExceptionMatches(PyExc_TypeError)) {
PyErr_SetString(PyExc_TypeError,
"capath should be a valid filesystem path");
}
goto error;
}
Also, I checked the certificate file and the password is correct so I don't understand why I am getting this error.
Can someone explains to me what this error mean?
Is it because the certificate I was given is not working or is it because I did something wrong in the code?
I tested with another certificate and it is working so I was wondering what kind of input I should put in certfile.
Thank you in advance and let me know if you need more explanation (I tried to put as much information as I could).
Ok, I found the solution: I re-ran the certificate using an OpenSSL Command Prompt with the following command:
openssl pkcs12 -in clear-s2s-prod.pfx -out cfsb-prod.cer -nodes