[pgsqlclient-checkins] pgsqlclient_10/Mono.Security/Mono.Security/Mono.Security.Protocol.Tls.Handsha
Status: Inactive
Brought to you by:
carlosga_fb
From: Carlos Guzm?n ?l. <car...@us...> - 2004-04-21 12:56:20
|
Update of /cvsroot/pgsqlclient/pgsqlclient_10/Mono.Security/Mono.Security/Mono.Security.Protocol.Tls.Handshake.Client In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv18403 Modified Files: TlsClientCertificate.cs TlsClientCertificateVerify.cs TlsServerCertificate.cs TlsServerCertificateRequest.cs TlsServerFinished.cs TlsServerHello.cs Log Message: 2004-04-22 Carlos Guzman Alvarez <car...@te...> * Mono.Security.Protocol.Tls/DebugHelper.cs: - New class. Index: TlsClientCertificateVerify.cs =================================================================== RCS file: /cvsroot/pgsqlclient/pgsqlclient_10/Mono.Security/Mono.Security/Mono.Security.Protocol.Tls.Handshake.Client/TlsClientCertificateVerify.cs,v retrieving revision 1.6 retrieving revision 1.7 diff -C2 -d -r1.6 -r1.7 *** TlsClientCertificateVerify.cs 10 Apr 2004 11:15:43 -0000 1.6 --- TlsClientCertificateVerify.cs 21 Apr 2004 12:54:52 -0000 1.7 *************** *** 65,71 **** if (privKey == null) { ! throw new TlsException( ! AlertDescription.UserCancelled, ! "Client certificate Private Key unavailable."); } else --- 65,69 ---- if (privKey == null) { ! throw new TlsException(AlertDescription.UserCancelled, "Client certificate Private Key unavailable."); } else *************** *** 97,103 **** if (privKey == null) { ! throw new TlsException( ! AlertDescription.UserCancelled, ! "Client certificate Private Key unavailable."); } else --- 95,99 ---- if (privKey == null) { ! throw new TlsException(AlertDescription.UserCancelled, "Client certificate Private Key unavailable."); } else Index: TlsServerCertificateRequest.cs =================================================================== RCS file: /cvsroot/pgsqlclient/pgsqlclient_10/Mono.Security/Mono.Security/Mono.Security.Protocol.Tls.Handshake.Client/TlsServerCertificateRequest.cs,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** TlsServerCertificateRequest.cs 10 Mar 2004 15:48:48 -0000 1.5 --- TlsServerCertificateRequest.cs 21 Apr 2004 12:54:54 -0000 1.6 *************** *** 64,68 **** protected override void ProcessAsSsl3() { ! throw new NotSupportedException(); } --- 64,68 ---- protected override void ProcessAsSsl3() { ! this.ProcessAsTls1(); } Index: TlsServerCertificate.cs =================================================================== RCS file: /cvsroot/pgsqlclient/pgsqlclient_10/Mono.Security/Mono.Security/Mono.Security.Protocol.Tls.Handshake.Client/TlsServerCertificate.cs,v retrieving revision 1.9 retrieving revision 1.10 diff -C2 -d -r1.9 -r1.10 *** TlsServerCertificate.cs 10 Apr 2004 11:15:43 -0000 1.9 --- TlsServerCertificate.cs 21 Apr 2004 12:54:53 -0000 1.10 *************** *** 97,100 **** --- 97,104 ---- readed += certLength; + + DebugHelper.WriteLine( + String.Format("Server Certificate {0}", certificates.Count), + buffer); } } Index: TlsClientCertificate.cs =================================================================== RCS file: /cvsroot/pgsqlclient/pgsqlclient_10/Mono.Security/Mono.Security/Mono.Security.Protocol.Tls.Handshake.Client/TlsClientCertificate.cs,v retrieving revision 1.6 retrieving revision 1.7 diff -C2 -d -r1.6 -r1.7 *** TlsClientCertificate.cs 10 Apr 2004 11:15:43 -0000 1.6 --- TlsClientCertificate.cs 21 Apr 2004 12:54:41 -0000 1.7 *************** *** 62,72 **** #warning "Client certificate selection is unfinished" ClientContext context = (ClientContext)this.Context; if (context.ClientSettings.Certificates == null || context.ClientSettings.Certificates.Count == 0) { ! throw new TlsException( ! AlertDescription.UserCancelled, ! "Client certificate requested by the server and no client certificate specified."); } --- 62,71 ---- #warning "Client certificate selection is unfinished" ClientContext context = (ClientContext)this.Context; + string msg = "Client certificate requested by the server and no client certificate specified."; if (context.ClientSettings.Certificates == null || context.ClientSettings.Certificates.Count == 0) { ! throw new TlsException(AlertDescription.UserCancelled, msg); } *************** *** 82,88 **** if (clientCert == null) { ! throw new TlsException( ! AlertDescription.UserCancelled, ! "Client certificate requested by the server and no client certificate specified."); } --- 81,85 ---- if (clientCert == null) { ! throw new TlsException(AlertDescription.UserCancelled, msg); } Index: TlsServerHello.cs =================================================================== RCS file: /cvsroot/pgsqlclient/pgsqlclient_10/Mono.Security/Mono.Security/Mono.Security.Protocol.Tls.Handshake.Client/TlsServerHello.cs,v retrieving revision 1.6 retrieving revision 1.7 diff -C2 -d -r1.6 -r1.7 *** TlsServerHello.cs 10 Apr 2004 11:15:43 -0000 1.6 --- TlsServerHello.cs 21 Apr 2004 12:54:54 -0000 1.7 *************** *** 59,62 **** --- 59,66 ---- this.Context.ProtocolNegotiated = true; + DebugHelper.WriteLine("Selected Cipher Suite {0}", this.cipherSuite.Name); + DebugHelper.WriteLine("Client random", this.Context.ClientRandom); + DebugHelper.WriteLine("Server random", this.Context.ServerRandom); + // Compute ClientRandom + ServerRandom TlsStream random = new TlsStream(); *************** *** 64,68 **** random.Write(this.Context.ServerRandom); this.Context.RandomCS = random.ToArray(); ! // Server Random + Client Random random.Reset(); --- 68,72 ---- random.Write(this.Context.ServerRandom); this.Context.RandomCS = random.ToArray(); ! // Server Random + Client Random random.Reset(); *************** *** 90,94 **** // Read random - Unix time + Random bytes this.random = this.ReadBytes(32); ! // Read Session id int length = (int)ReadByte(); --- 94,98 ---- // Read random - Unix time + Random bytes this.random = this.ReadBytes(32); ! // Read Session id int length = (int)ReadByte(); *************** *** 103,107 **** { // The server has sent an invalid ciphersuite ! throw new TlsException("Invalid cipher suite received from server"); } this.cipherSuite = this.Context.SupportedCiphers[cipherCode]; --- 107,111 ---- { // The server has sent an invalid ciphersuite ! throw new TlsException(AlertDescription.InsuficientSecurity, "Invalid cipher suite received from server"); } this.cipherSuite = this.Context.SupportedCiphers[cipherCode]; *************** *** 126,129 **** --- 130,135 ---- this.Context.SupportedCiphers = null; this.Context.SupportedCiphers = CipherSuiteFactory.GetSupportedCiphers(serverProtocol); + + DebugHelper.WriteLine("Selected protocol {0}", serverProtocol); } else Index: TlsServerFinished.cs =================================================================== RCS file: /cvsroot/pgsqlclient/pgsqlclient_10/Mono.Security/Mono.Security/Mono.Security.Protocol.Tls.Handshake.Client/TlsServerFinished.cs,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** TlsServerFinished.cs 9 Mar 2004 22:05:30 -0000 1.5 --- TlsServerFinished.cs 21 Apr 2004 12:54:54 -0000 1.6 *************** *** 77,81 **** if (clientHash.Length != serverHash.Length) { ! throw new TlsException("Invalid ServerFinished message received."); } for (int i = 0; i < serverHash.Length; i++) --- 77,82 ---- if (clientHash.Length != serverHash.Length) { ! #warning Review that selected alert is correct ! throw new TlsException(AlertDescription.InsuficientSecurity, "Invalid ServerFinished message received."); } for (int i = 0; i < serverHash.Length; i++) *************** *** 83,87 **** if (clientHash[i] != serverHash[i]) { ! throw new TlsException("Invalid ServerFinished message received."); } } --- 84,88 ---- if (clientHash[i] != serverHash[i]) { ! throw new TlsException(AlertDescription.InsuficientSecurity, "Invalid ServerFinished message received."); } } *************** *** 109,113 **** if (clientPRF[i] != serverPRF[i]) { ! throw new TlsException("Invalid ServerFinished message received."); } } --- 110,114 ---- if (clientPRF[i] != serverPRF[i]) { ! throw new TlsException(AlertDescription.InsuficientSecurity, "Invalid ServerFinished message received."); } } |