Search Postgresql Archives

Re: SSL Certificates in Windows 7 & Postgres 9.3

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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.


-- 
Sent via pgsql-general mailing list (pgsql-general@xxxxxxxxxxxxxx)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-general




[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Postgresql Jobs]     [Postgresql Admin]     [Postgresql Performance]     [Linux Clusters]     [PHP Home]     [PHP on Windows]     [Kernel Newbies]     [PHP Classes]     [PHP Books]     [PHP Databases]     [Postgresql & PHP]     [Yosemite]
  Powered by Linux