I'm trying to connect to db using the following code (simple windows.forms .net 3.5 project) :
Code: Select all
PgSqlConnection c = new PgSqlConnection("host=192.168.3.167;database=mydatabase;user id=postgres;Password=mypassword");
certsDir = "c:\\temp\\certs";
c.SslOptions.CACert = Path.Combine(certsDir, "root.crt");
c.SslOptions.Cert = Path.Combine(certsDir, "postgresql.crt");
c.SslOptions.Key = Path.Combine(certsDir, "postgresql.key");
c.SslOptions.SslMode = SslMode.Require;
c.Open();
which would mean that there is a problem with certificates.Verification check of remote certificate failed.
However, if I use the same certificates in odbc (using psqlODBC) I can connect to database without any problems (using SSL Mode: verify-ca).
Also, if I use the same certificates from python (using psycopg2 library) I can also connect to database without any problems
Code: Select all
db=psycopg2.connect(host="192.168.3.167", database="mydatabase", user="postgres", password="mypassword", sslmode="require", sslrootcert='root.crt', sslcert='postgresql.crt', sslkey='postgresql.key')