I did not have a clue about encryption until today so please pardon me if my question is to basic.
I have a GCP SQL instance that is set up for Postgres with SSL encryption. I have created a client certificate on GCP and dowloaded and stored the:
- server-ca.pem
- client-cert.pem
- client-key.pem
files in my computer.
I am trying to connect to the remote DB using psycopg2 in python3.6 (installed using conda). I have checked the documentation for establishing the connection and apparently the above files need to be used so that I can establish the connection. In specific in the psycopg2.connect() function I use the arguments:
sslmode='verify-ca'sslcert=[local path of client-cert.pem file]sslkey=[local path of client-key.pem file]sslrootcert=[local path of server-ca.pem file]
Apparently there will be an error because according to this the the above files need to end in the following formats: .crt , .key.
After my research I found out that I (maybe) have to use openssl to generate the .crt and .key formats. How am I supposed to do that?
If I convert the .pem files and pass the converted ones to the psycopg2.connect() will I be able to connect to my remote DB?