[pgsqlclient-checkins] pgsqlclient_10/Mono.Security.Protocol.Tls/Mono.Security.Protocol.Tls/Mono.Sec
Status: Inactive
Brought to you by:
carlosga_fb
From: <car...@us...> - 2003-10-20 11:32:38
|
Update of /cvsroot/pgsqlclient/pgsqlclient_10/Mono.Security.Protocol.Tls/Mono.Security.Protocol.Tls/Mono.Security.Protocol.Tls.Handshake/Mono.Security.Protocol.Tls.Handshake.Client In directory sc8-pr-cvs1:/tmp/cvs-serv29957 Modified Files: TlsClientFinished.cs TlsClientHello.cs TlsClientKeyExchange.cs TlsServerFinished.cs TlsServerHello.cs Log Message: * TLS implementation: - Fixed padding length calculation on record encryption. - Abstracted CipherSuite classes for allow work with other protocol versions. - Added new files : TlsAbstractCipherSuite.cs TlsSslCipherSuite.cs TlsCipherSuiteFactory.cs - Added new cipher suites definitions based on RFC3268 - (http://www.ietf.org/rfc/rfc3268.txt) - Added two new supported ciphersuites for TLS protocol: TLS_RSA_WITH_AES_256_CBC_SHA TLS_RSA_WITH_AES_128_CBC_SHA - Moved key generation stuff to specific cipher suite classes. Index: TlsClientFinished.cs =================================================================== RCS file: /cvsroot/pgsqlclient/pgsqlclient_10/Mono.Security.Protocol.Tls/Mono.Security.Protocol.Tls/Mono.Security.Protocol.Tls.Handshake/Mono.Security.Protocol.Tls.Handshake.Client/TlsClientFinished.cs,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** TlsClientFinished.cs 16 Oct 2003 14:25:57 -0000 1.4 --- TlsClientFinished.cs 20 Oct 2003 10:01:19 -0000 1.5 *************** *** 65,69 **** // Write message contents ! Write(Session.Context.PRF(Session.Context.MasterSecret, "client finished", hashes.ToArray(), 12)); // Reset data --- 65,69 ---- // Write message contents ! Write(Session.Context.Cipher.PRF(Session.Context.MasterSecret, "client finished", hashes.ToArray(), 12)); // Reset data Index: TlsClientHello.cs =================================================================== RCS file: /cvsroot/pgsqlclient/pgsqlclient_10/Mono.Security.Protocol.Tls/Mono.Security.Protocol.Tls/Mono.Security.Protocol.Tls.Handshake/Mono.Security.Protocol.Tls.Handshake.Client/TlsClientHello.cs,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** TlsClientHello.cs 16 Oct 2003 14:25:57 -0000 1.4 --- TlsClientHello.cs 20 Oct 2003 10:01:19 -0000 1.5 *************** *** 70,79 **** { // Client Version ! Write((short)Session.Context.Protocol); // Random bytes - Unix time + Radom bytes [28] TlsStream clientRandom = new TlsStream(); ! clientRandom.Write(Session.Context.GetUnixTime()); ! clientRandom.Write(Session.Context.GetSecureRandomBytes(28)); this.random = clientRandom.ToArray(); clientRandom.Reset(); --- 70,79 ---- { // Client Version ! Write((short)this.Session.Context.Protocol); // Random bytes - Unix time + Radom bytes [28] TlsStream clientRandom = new TlsStream(); ! clientRandom.Write(this.Session.Context.GetUnixTime()); ! clientRandom.Write(this.Session.Context.GetSecureRandomBytes(28)); this.random = clientRandom.ToArray(); clientRandom.Reset(); *************** *** 83,92 **** // Session id // Send the session ID empty ! if (Session.SessionId != null) { ! Write((byte)Session.SessionId.Length); ! if (Session.SessionId.Length > 0) { ! Write(Session.SessionId); } } --- 83,92 ---- // Session id // Send the session ID empty ! if (this.Session.SessionId != null) { ! Write((byte)this.Session.SessionId.Length); ! if (this.Session.SessionId.Length > 0) { ! Write(this.Session.SessionId); } } *************** *** 97,106 **** // Write length of Cipher suites ! Write((short)(Session.SupportedCiphers.Count*2)); // Write Supported Cipher suites ! for (int i = 0; i < Session.SupportedCiphers.Count; i++) { ! Write((short)Session.SupportedCiphers[i].Code); } --- 97,106 ---- // Write length of Cipher suites ! Write((short)(this.Session.SupportedCiphers.Count*2)); // Write Supported Cipher suites ! for (int i = 0; i < this.Session.SupportedCiphers.Count; i++) { ! Write((short)this.Session.SupportedCiphers[i].Code); } Index: TlsClientKeyExchange.cs =================================================================== RCS file: /cvsroot/pgsqlclient/pgsqlclient_10/Mono.Security.Protocol.Tls/Mono.Security.Protocol.Tls/Mono.Security.Protocol.Tls.Handshake/Mono.Security.Protocol.Tls.Handshake.Client/TlsClientKeyExchange.cs,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** TlsClientKeyExchange.cs 16 Oct 2003 14:25:57 -0000 1.3 --- TlsClientKeyExchange.cs 20 Oct 2003 10:01:19 -0000 1.4 *************** *** 52,56 **** { // Compute pre master secret ! byte[] preMasterSecret = Session.Context.CreatePremasterSecret(); // Create a new RSA key --- 52,56 ---- { // Compute pre master secret ! byte[] preMasterSecret = Session.Context.Cipher.CreatePremasterSecret(); // Create a new RSA key *************** *** 74,81 **** // Create master secret ! Session.Context.CreateMasterSecret(preMasterSecret); // Create keys ! Session.Context.CreateKeys(); // Clear resources --- 74,81 ---- // Create master secret ! Session.Context.Cipher.CreateMasterSecret(preMasterSecret); // Create keys ! Session.Context.Cipher.CreateKeys(); // Clear resources Index: TlsServerFinished.cs =================================================================== RCS file: /cvsroot/pgsqlclient/pgsqlclient_10/Mono.Security.Protocol.Tls/Mono.Security.Protocol.Tls/Mono.Security.Protocol.Tls.Handshake/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 16 Oct 2003 14:25:57 -0000 1.5 --- TlsServerFinished.cs 20 Oct 2003 10:01:19 -0000 1.6 *************** *** 65,69 **** hashes.Write(Session.Context.HandshakeHashes.GetSHAHash()); ! byte[] clientPRF = Session.Context.PRF(Session.Context.MasterSecret, "server finished", hashes.ToArray(), 12); hashes.Reset(); --- 65,69 ---- hashes.Write(Session.Context.HandshakeHashes.GetSHAHash()); ! byte[] clientPRF = Session.Context.Cipher.PRF(Session.Context.MasterSecret, "server finished", hashes.ToArray(), 12); hashes.Reset(); Index: TlsServerHello.cs =================================================================== RCS file: /cvsroot/pgsqlclient/pgsqlclient_10/Mono.Security.Protocol.Tls/Mono.Security.Protocol.Tls/Mono.Security.Protocol.Tls.Handshake/Mono.Security.Protocol.Tls.Handshake.Client/TlsServerHello.cs,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** TlsServerHello.cs 16 Oct 2003 14:25:57 -0000 1.4 --- TlsServerHello.cs 20 Oct 2003 10:01:19 -0000 1.5 *************** *** 58,62 **** Session.Context.Cipher = this.cipherSuite; Session.Context.CompressionMethod = this.compressionMethod; ! Session.Context.Cipher.SessionState = Session.Context; } --- 58,62 ---- Session.Context.Cipher = this.cipherSuite; Session.Context.CompressionMethod = this.compressionMethod; ! Session.Context.Cipher.Context = this.Session.Context; } *************** *** 73,80 **** { // Read protocol version ! this.protocol = (TlsProtocol)ReadInt16(); // Read random - Unix time + Random bytes ! this.random = ReadBytes(32); // Read Session id --- 73,80 ---- { // Read protocol version ! this.protocol = (TlsProtocol)this.ReadInt16(); // Read random - Unix time + Random bytes ! this.random = this.ReadBytes(32); // Read Session id *************** *** 82,99 **** if (length > 0) { ! this.sessionId = ReadBytes(length); } // Read cipher suite ! short cipherCode = ReadInt16(); ! if (Session.SupportedCiphers.IndexOf(cipherCode) == -1) { // The server has sent an invalid ciphersuite throw new TlsException("Invalid cipher suite received from server"); } ! cipherSuite = Session.SupportedCiphers[cipherCode]; // Read compression methods ( always 0 ) ! compressionMethod = ReadByte(); } --- 82,99 ---- if (length > 0) { ! this.sessionId = this.ReadBytes(length); } // Read cipher suite ! short cipherCode = this.ReadInt16(); ! if (this.Session.SupportedCiphers.IndexOf(cipherCode) == -1) { // The server has sent an invalid ciphersuite throw new TlsException("Invalid cipher suite received from server"); } ! this.cipherSuite = this.Session.SupportedCiphers[cipherCode]; // Read compression methods ( always 0 ) ! this.compressionMethod = this.ReadByte(); } |