[pgsqlclient-checkins] pgsqlclient_10/PostgreSql.Data.PgSqlClient/source PgConnection.cs,1.12,1.13
Status: Inactive
Brought to you by:
carlosga_fb
From: <car...@us...> - 2004-03-06 14:56:55
|
Update of /cvsroot/pgsqlclient/pgsqlclient_10/PostgreSql.Data.PgSqlClient/source In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv1452 Modified Files: PgConnection.cs Log Message: 2004-03-06 Carlos Guzman Alvarez <car...@te...> * source/PgConnection.cs: - Added event for allow client certificate private key selection. Index: PgConnection.cs =================================================================== RCS file: /cvsroot/pgsqlclient/pgsqlclient_10/PostgreSql.Data.PgSqlClient/source/PgConnection.cs,v retrieving revision 1.12 retrieving revision 1.13 diff -C2 -d -r1.12 -r1.13 *** PgConnection.cs 9 Feb 2004 14:19:22 -0000 1.12 --- PgConnection.cs 6 Mar 2004 14:42:00 -0000 1.13 *************** *** 23,28 **** --- 23,31 ---- using System.Collections; using System.ComponentModel; + using System.Security.Cryptography; using System.Security.Cryptography.X509Certificates; + using Mono.Security.Protocol.Tls; + using PostgreSql.Data.NPgClient; using PostgreSql.Data.PgSqlClient.DbSchema; *************** *** 42,46 **** public event CertificateValidationCallback ServerCertValidation; public event CertificateSelectionCallback ClientCertSelection; ! #endregion --- 45,49 ---- public event CertificateValidationCallback ServerCertValidation; public event CertificateSelectionCallback ClientCertSelection; ! public event PrivateKeySelectionCallback PrivateKeySelection; #endregion *************** *** 56,63 **** private ArrayList activeCommands; ! private PgClientMessageEventHandler infoMessageHandler; ! private PgClientNotificationEventHandler notificationHandler; ! private CertificateValidationCallback certificateValidation; ! private CertificateSelectionCallback certificateSelectionCallback; #endregion --- 59,67 ---- private ArrayList activeCommands; ! private PgClientMessageEventHandler infoMessageHandler; ! private PgClientNotificationEventHandler notificationHandler; ! private CertificateValidationCallback certificateValidationCallback; ! private CertificateSelectionCallback certificateSelectionCallback; ! private PrivateKeySelectionCallback privateKeySelectionCallback; #endregion *************** *** 406,415 **** { // Server certificate validation ! certificateValidation = new CertificateValidationCallback(OnServerCertificateValidation); ! dbConnection.DB.SslClientStream.ServerCertValidationDelegate = certificateValidation; // Client certificate selection certificateSelectionCallback = new CertificateSelectionCallback(OnClientCertificateSelection); dbConnection.DB.SslClientStream.ClientCertSelectionDelegate = certificateSelectionCallback; } } --- 410,423 ---- { // Server certificate validation ! certificateValidationCallback = new CertificateValidationCallback(OnServerCertificateValidation); ! dbConnection.DB.SslClientStream.ServerCertValidationDelegate = certificateValidationCallback; // Client certificate selection certificateSelectionCallback = new CertificateSelectionCallback(OnClientCertificateSelection); dbConnection.DB.SslClientStream.ClientCertSelectionDelegate = certificateSelectionCallback; + + // Private key selection + privateKeySelectionCallback = new PrivateKeySelectionCallback(OnPrivateKeySelection); + dbConnection.DB.SslClientStream.PrivateKeyCertSelectionDelegate = privateKeySelectionCallback; } } *************** *** 455,460 **** if (this.dbConnection.Settings.SSL) { ! ServerCertValidation -= certificateValidation; ClientCertSelection -= certificateSelectionCallback; } --- 463,469 ---- if (this.dbConnection.Settings.SSL) { ! ServerCertValidation -= certificateValidationCallback; ClientCertSelection -= certificateSelectionCallback; + PrivateKeySelection -= privateKeySelectionCallback; } *************** *** 627,631 **** private bool OnServerCertificateValidation( ! X509Certificate certificate, int[] certificateErrors) { if (this.ServerCertValidation != null) --- 636,641 ---- private bool OnServerCertificateValidation( ! X509Certificate certificate, ! int[] certificateErrors) { if (this.ServerCertValidation != null) *************** *** 638,645 **** private X509Certificate OnClientCertificateSelection( ! X509CertificateCollection clientCertificates, ! X509Certificate serverCertificate, ! string targetHost, ! X509CertificateCollection serverRequestedCertificates) { if (this.ClientCertSelection != null) --- 648,655 ---- private X509Certificate OnClientCertificateSelection( ! X509CertificateCollection clientCertificates, ! X509Certificate serverCertificate, ! string targetHost, ! X509CertificateCollection serverRequestedCertificates) { if (this.ClientCertSelection != null) *************** *** 655,658 **** --- 665,681 ---- } + private AsymmetricAlgorithm OnPrivateKeySelection( + X509Certificate clientCertificate, + string targetHost) + { + if (this.PrivateKeySelection != null) + { + return this.PrivateKeySelection(clientCertificate, targetHost); + } + + return null; + } + + #endregion } |