[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-21 16:09:48
|
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-serv25886 Modified Files: TlsClientHello.cs TlsClientKeyExchange.cs TlsServerCertificate.cs TlsServerHello.cs Log Message: Added partial implementation of SSL3 protocol 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.6 retrieving revision 1.7 diff -C2 -d -r1.6 -r1.7 *** TlsClientHello.cs 20 Oct 2003 18:22:57 -0000 1.6 --- TlsClientHello.cs 21 Oct 2003 16:06:15 -0000 1.7 *************** *** 39,45 **** public TlsClientHello(TlsSession session) ! : base(session, ! TlsHandshakeType.ClientHello, ! TlsContentType.Handshake) { } --- 39,43 ---- public TlsClientHello(TlsSession session) ! : base(session, TlsHandshakeType.ClientHello, TlsContentType.Handshake) { } *************** *** 64,68 **** protected override void ProcessAsSsl3() { ! throw new NotSupportedException(); } --- 62,66 ---- protected override void ProcessAsSsl3() { ! this.ProcessAsTls1(); } 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.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** TlsClientKeyExchange.cs 20 Oct 2003 10:01:19 -0000 1.4 --- TlsClientKeyExchange.cs 21 Oct 2003 16:06:15 -0000 1.5 *************** *** 46,50 **** protected override void ProcessAsSsl3() { ! throw new NotSupportedException(); } --- 46,50 ---- protected override void ProcessAsSsl3() { ! this.ProcessAsTls1(); } Index: TlsServerCertificate.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/TlsServerCertificate.cs,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** TlsServerCertificate.cs 16 Oct 2003 14:25:57 -0000 1.4 --- TlsServerCertificate.cs 21 Oct 2003 16:06:15 -0000 1.5 *************** *** 71,75 **** protected override void ProcessAsSsl3() { ! throw new NotSupportedException(); } --- 71,75 ---- protected override void ProcessAsSsl3() { ! this.ProcessAsTls1(); } 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.6 retrieving revision 1.7 diff -C2 -d -r1.6 -r1.7 *** TlsServerHello.cs 20 Oct 2003 18:22:57 -0000 1.6 --- TlsServerHello.cs 21 Oct 2003 16:06:15 -0000 1.7 *************** *** 35,39 **** private byte[] random; private byte[] sessionId; ! private TlsCipherSuite cipherSuite; #endregion --- 35,39 ---- private byte[] random; private byte[] sessionId; ! private TlsAbstractCipherSuite cipherSuite; #endregion *************** *** 59,62 **** --- 59,76 ---- Session.Context.CompressionMethod = this.compressionMethod; Session.Context.Cipher.Context = this.Session.Context; + + // Compute ClientRandom + ServerRandom + TlsStream random = new TlsStream(); + random.Write(Session.Context.ClientRandom); + random.Write(Session.Context.ServerRandom); + Session.Context.RandomCS = random.ToArray(); + + // Server Random + Client Random + random.Reset(); + random.Write(Session.Context.ServerRandom); + random.Write(Session.Context.ClientRandom); + + Session.Context.RandomSC = random.ToArray(); + random.Reset(); } *************** *** 67,71 **** protected override void ProcessAsSsl3() { ! throw new NotSupportedException(); } --- 81,108 ---- protected override void ProcessAsSsl3() { ! // Read protocol version ! this.protocol = (TlsProtocol)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.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 = (TlsCompressionMethod)this.ReadByte(); } |