Re: SSL Certificates in Windows 7 & Postgres 9.3
От | harpagornis |
---|---|
Тема | Re: SSL Certificates in Windows 7 & Postgres 9.3 |
Дата | |
Msg-id | 1418685927656-5830786.post@n5.nabble.com обсуждение исходный текст |
Ответ на | Re: SSL Certificates in Windows 7 & Postgres 9.3 (Adrian Klaver <adrian.klaver@aklaver.com>) |
Ответы |
Re: SSL Certificates in Windows 7 & Postgres 9.3
Re: SSL Certificates in Windows 7 & Postgres 9.3 |
Список | pgsql-general |
Yes, I did intend for only SSL connections. The console app must be the SYSTEM user then, directly or maybe indirectly through the Windows Certificate Store. I already added root.crt to the trusted certificates through Windows MMC. Here is my console app, in which I provide the certificate, so what else needs to be done? ----------------------------------------------------------------------------- NpgsqlConnection conn = new NpgsqlConnection(conStr); conn.ProvideClientCertificatesCallback += new ProvideClientCertificatesCallback(MyProvideClientCertificates); /*This callback simply returns true indicating you are accepting the server certificate. Obviously, returning true without doing any validation should be done for testing purposes only. */ conn.ValidateRemoteCertificateCallback += (a, b, c) => { return true; }; try { conn.Open(); System.Console.WriteLine("Connection opened"); } catch (Exception e) { System.Console.WriteLine(e); } finally { conn.Close(); System.Console.ReadLine(); } } private static void MyProvideClientCertificates(X509CertificateCollection clienteCertis) { const string clientcert = "d:\postgrclient.p12"; X509Certificate2 cert = new X509Certificate2(clientcert, "password", X509KeyStorageFlags.PersistKeySet | X509KeyStorageFlags.MachineKeySet); Console.WriteLine(cert.HasPrivateKey); clienteCertis.Add(cert); } -- View this message in context: http://postgresql.nabble.com/SSL-Certificates-in-Windows-7-Postgres-9-3-tp5830749p5830786.html Sent from the PostgreSQL - general mailing list archive at Nabble.com.
В списке pgsql-general по дате отправления: