[pgsqlclient-checkins] pgsqlclient_10/Mono.Security/Mono.Security/Mono.Security.Protocol.Tls.Handsha
Status: Inactive
Brought to you by:
carlosga_fb
From: <car...@us...> - 2004-02-20 19:50:25
|
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-serv7490 Modified Files: TlsClientHello.cs TlsServerHello.cs Log Message: 2004-02-20 Carlos Guzmán Álvarez <car...@te...> * Mono.Security.Protocol.Tls/SslClientStream.cs: * Mono.Security.Protocol.Tls/RecordProtocol.cs: * Mono.Security.Protocol.Tls/TlsContext.cs: - Added changes for handle te SecurityProtocolType enum as a Flags enum. * Mono.Security.Protocol.Tls.Handshake.Client/TlsClientHello.cs: - Let the Ssl3 message to be process in the same way as the Tls1. * Mono.Security.Protocol.Tls.Handshake.Client/TlsClientHello.cs: - Added changes for use the Protocol version send by the server * Mono.Security.Protocol.Tls/CipherSuite.cs: - Compute the premaster secret using the protocol version sent in the ClientHello message instead of the actual protocol version. Index: TlsClientHello.cs =================================================================== RCS file: /cvsroot/pgsqlclient/pgsqlclient_10/Mono.Security/Mono.Security/Mono.Security.Protocol.Tls.Handshake.Client/TlsClientHello.cs,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** TlsClientHello.cs 17 Feb 2004 17:51:06 -0000 1.2 --- TlsClientHello.cs 20 Feb 2004 18:15:20 -0000 1.3 *************** *** 32,36 **** #region Fields ! private byte[] random; #endregion --- 32,36 ---- #region Fields ! private byte[] random; #endregion *************** *** 51,55 **** base.Update(); ! this.Context.ClientRandom = random; random = null; --- 51,56 ---- base.Update(); ! this.Context.ClientRandom = random; ! this.Context.ClientHelloProtocol = this.Context.Protocol; random = null; 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.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** TlsServerHello.cs 10 Feb 2004 09:45:30 -0000 1.1 --- TlsServerHello.cs 20 Feb 2004 18:15:20 -0000 1.2 *************** *** 31,35 **** #region Fields - private SecurityProtocolType protocol; private SecurityCompressionType compressionMethod; private byte[] random; --- 31,34 ---- *************** *** 81,89 **** protected override void ProcessAsSsl3() { // Read protocol version ! this.protocol = (SecurityProtocolType)this.ReadInt16(); // Read random - Unix time + Random bytes ! this.random = this.ReadBytes(32); // Read Session id --- 80,93 ---- protected override void ProcessAsSsl3() { + this.ProcessAsTls1(); + } + + protected override void ProcessAsTls1() + { // Read protocol version ! this.processProtocol(this.ReadInt16()); // Read random - Unix time + Random bytes ! this.random = this.ReadBytes(32); // Read Session id *************** *** 107,136 **** } ! protected override void ProcessAsTls1() { ! // Read protocol version ! this.protocol = (SecurityProtocolType)this.ReadInt16(); ! ! // Read random - Unix time + Random bytes ! this.random = this.ReadBytes(32); ! ! // Read Session id ! int length = (int)ReadByte(); ! if (length > 0) { ! this.sessionId = this.ReadBytes(length); } ! ! // Read cipher suite ! short cipherCode = this.ReadInt16(); ! if (this.Context.SupportedCiphers.IndexOf(cipherCode) == -1) { ! // The server has sent an invalid ciphersuite ! throw new TlsException("Invalid cipher suite received from server"); } - this.cipherSuite = this.Context.SupportedCiphers[cipherCode]; - - // Read compression methods ( always 0 ) - this.compressionMethod = (SecurityCompressionType)this.ReadByte(); } --- 111,133 ---- } ! #endregion ! ! #region Private Methods ! ! private void processProtocol(short protocol) { ! SecurityProtocolType serverProtocol = this.Context.DecodeProtocolCode(protocol); ! ! if ((serverProtocol & this.Context.SecurityProtocolFlags) == serverProtocol) { ! this.Context.SecurityProtocol = serverProtocol; ! this.Context.SupportedCiphers.Clear(); ! this.Context.SupportedCiphers = null; ! this.Context.SupportedCiphers = TlsCipherSuiteFactory.GetSupportedCiphers(serverProtocol); } ! else { ! throw this.Context.CreateException("Incorrect protocol version received from server"); } } |