2

We were able to establish a connection with regular (username and password) now we want to connect via ssl.

I'm trying to connect to postgresql server with nhibernate (v4.0) using ssl certificate.

I'm getting error message "connection requires a valid client certificate.

Where I need to save the key on the server for the nhibernate to use it. or how to specify the path for the cert and the key.

The error Is in postgres, but the nhibernate doesn't bring the certificate. how do I configure nhibernate to provide the certificate? please help..

I'v tried adding sslkey, sslcert paramaters to the connection string with no luck.

var config  = Flunety.Configure().Datebase(PostgresSQLConfiguration.Standart.ConnectionString(x=>x.FromConnectionStringWithKey(ConnectionString)) ….
connectionString = "Server=server;Port=5432;User Id=username;sslMode=require;

FATAL 28000 connection requires a valid client certificate.

arun v
  • 852
  • 7
  • 19

1 Answers1

0

Assuming you're using Npgsql, see this section in the docs: the NpgsqlConnection type exposes two callbacks for SSL/TLS operation, which it simply forwards to the internally-used SslStream.

I'm not sure if/how NHibernate exposes these, but it should be possible to get (or provide) an instance of NpgsqlConnection on which you can set these callbacks.

Shay Rojansky
  • 15,357
  • 2
  • 40
  • 69