[pgsqlclient-checkins] pgsqlclient_10/Mono.Security.Protocol.Tls/Mono.Security.Protocol.Tls/Mono.Sec
Status: Inactive
Brought to you by:
carlosga_fb
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-serv1464 Modified Files: TlsClientCertificate.cs TlsClientFinished.cs TlsClientHello.cs TlsClientKeyExchange.cs TlsServerCertificate.cs TlsServerCertificateRequest.cs TlsServerFinished.cs TlsServerHello.cs TlsServerHelloDone.cs TlsServerKeyExchange.cs Log Message: Added more enhacements to the Handshake protocol Index: TlsClientCertificate.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/TlsClientCertificate.cs,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** TlsClientCertificate.cs 11 Oct 2003 10:09:37 -0000 1.1 --- TlsClientCertificate.cs 13 Oct 2003 20:48:19 -0000 1.2 *************** *** 65,70 **** // Compose the message ! Writer.WriteInt24((int)stream.Length); ! Writer.Write(stream.GetBytes()); } --- 65,70 ---- // Compose the message ! WriteInt24((int)stream.Length); ! Write(stream.GetBytes()); } 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.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** TlsClientFinished.cs 11 Oct 2003 10:09:37 -0000 1.1 --- TlsClientFinished.cs 13 Oct 2003 20:48:19 -0000 1.2 *************** *** 60,64 **** // Write message contents ! Writer.Write(Session.Context.PRF(Session.Context.MasterSecret, "client finished", hashes.GetBytes(), 12)); // Reset data --- 60,64 ---- // Write message contents ! Write(Session.Context.PRF(Session.Context.MasterSecret, "client finished", hashes.GetBytes(), 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.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** TlsClientHello.cs 11 Oct 2003 10:09:37 -0000 1.1 --- TlsClientHello.cs 13 Oct 2003 20:48:19 -0000 1.2 *************** *** 65,69 **** { // Client Version ! Writer.WriteShort((short)Session.Context.Protocol); // Random bytes - Unix time + Radom bytes --- 65,69 ---- { // Client Version ! Write((short)Session.Context.Protocol); // Random bytes - Unix time + Radom bytes *************** *** 76,80 **** rng.GetNonZeroBytes(r); rnd.Write(r); ! Writer.Write(rnd.GetBytes()); random = rnd.GetBytes(); --- 76,80 ---- rng.GetNonZeroBytes(r); rnd.Write(r); ! Write(rnd.GetBytes()); random = rnd.GetBytes(); *************** *** 86,114 **** if (Session.SessionId != null) { ! Writer.Write((byte)Session.SessionId.Length); if (Session.SessionId.Length > 0) { ! Writer.Write(Session.SessionId); } } else { ! Writer.Write((byte)0); } // Write length of Cipher suites ! Writer.WriteShort((short)(Session.SupportedCiphers.Count*2)); // Write Supported Cipher suites for (int i = 0; i < Session.SupportedCiphers.Count; i++) { ! Writer.WriteShort(Session.SupportedCiphers[i].Code); } // Compression methods length ! Writer.Write((byte)1); // Compression methods ( 0 = none ) ! Writer.Write((byte)0); } --- 86,114 ---- if (Session.SessionId != null) { ! Write((byte)Session.SessionId.Length); if (Session.SessionId.Length > 0) { ! Write(Session.SessionId); } } else { ! Write((byte)0); } // 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); } // Compression methods length ! Write((byte)1); // Compression methods ( 0 = none ) ! Write((byte)0); } 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.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** TlsClientKeyExchange.cs 11 Oct 2003 10:09:37 -0000 1.1 --- TlsClientKeyExchange.cs 13 Oct 2003 20:48:19 -0000 1.2 *************** *** 65,70 **** // Write the preMasterSecret encrypted byte[] buffer = formatter.CreateKeyExchange(preMasterSecret); ! Writer.WriteShort((short)buffer.Length); ! Writer.Write(buffer); // Create master secret --- 65,70 ---- // Write the preMasterSecret encrypted byte[] buffer = formatter.CreateKeyExchange(preMasterSecret); ! Write((short)buffer.Length); ! Write(buffer); // Create master secret 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.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** TlsServerCertificate.cs 13 Oct 2003 19:15:13 -0000 1.2 --- TlsServerCertificate.cs 13 Oct 2003 20:48:19 -0000 1.3 *************** *** 50,55 **** #region CONSTRUCTORS ! public TlsServerCertificate(TlsSession session, TlsStreamReader reader) ! : base(session, TlsHandshakeType.Certificate, reader) { } --- 50,55 ---- #region CONSTRUCTORS ! public TlsServerCertificate(TlsSession session, byte[] buffer) ! : base(session, TlsHandshakeType.Certificate, buffer) { } *************** *** 74,83 **** int readed = 0; ! int length = Reader.ReadInt24(); while (readed < length) { // Read certificate length ! int certLength = Reader.ReadInt24(); // Increment readed --- 74,83 ---- int readed = 0; ! int length = ReadInt24(); while (readed < length) { // Read certificate length ! int certLength = ReadInt24(); // Increment readed *************** *** 87,91 **** { // Read certificate ! X509Certificate certificate = new X509Certificate(Reader.ReadBytes(certLength)); certificates.Add(certificate); --- 87,91 ---- { // Read certificate ! X509Certificate certificate = new X509Certificate(ReadBytes(certLength)); certificates.Add(certificate); Index: TlsServerCertificateRequest.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/TlsServerCertificateRequest.cs,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** TlsServerCertificateRequest.cs 13 Oct 2003 19:15:13 -0000 1.2 --- TlsServerCertificateRequest.cs 13 Oct 2003 20:48:19 -0000 1.3 *************** *** 40,45 **** #region CONSTRUCTORS ! public TlsServerCertificateRequest(TlsSession session, TlsStreamReader reader) ! : base(session, TlsHandshakeType.ServerHello, reader) { } --- 40,45 ---- #region CONSTRUCTORS ! public TlsServerCertificateRequest(TlsSession session, byte[] buffer) ! : base(session, TlsHandshakeType.ServerHello, buffer) { } *************** *** 65,69 **** { // Read requested certificate types ! int typesCount = Reader.ReadByte(); certificateTypes = new TlsClientCertificateType[typesCount]; --- 65,69 ---- { // Read requested certificate types ! int typesCount = ReadByte(); certificateTypes = new TlsClientCertificateType[typesCount]; *************** *** 71,75 **** for (int i = 0; i < typesCount; i++) { ! certificateTypes[i] = (TlsClientCertificateType)Reader.ReadByte(); } --- 71,75 ---- for (int i = 0; i < typesCount; i++) { ! certificateTypes[i] = (TlsClientCertificateType)ReadByte(); } *************** *** 85,90 **** * attributeValue ANY } */ ! int tmp = Reader.ReadShort(); ! ASN1 rdn = new ASN1(Reader.ReadBytes(Reader.ReadShort())); distinguisedNames = new string[rdn.Count]; --- 85,90 ---- * attributeValue ANY } */ ! int tmp = ReadInt16(); ! ASN1 rdn = new ASN1(ReadBytes(ReadInt16())); distinguisedNames = new string[rdn.Count]; 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.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** TlsServerFinished.cs 13 Oct 2003 19:15:13 -0000 1.2 --- TlsServerFinished.cs 13 Oct 2003 20:48:19 -0000 1.3 *************** *** 32,37 **** #region CONSTRUCTORS ! public TlsServerFinished(TlsSession session, TlsStreamReader reader) ! : base(session, TlsHandshakeType.ServerHello, reader) { } --- 32,37 ---- #region CONSTRUCTORS ! public TlsServerFinished(TlsSession session, byte[] buffer) ! : base(session, TlsHandshakeType.ServerHello, buffer) { } *************** *** 54,58 **** protected override void Parse() { ! byte[] serverPRF = Reader.ReadBytes((int)Reader.Length); TlsStreamWriter hashes = new TlsStreamWriter(); --- 54,58 ---- protected override void Parse() { ! byte[] serverPRF = ReadBytes((int)Length); TlsStreamWriter hashes = new TlsStreamWriter(); 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.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** TlsServerHello.cs 13 Oct 2003 19:15:13 -0000 1.2 --- TlsServerHello.cs 13 Oct 2003 20:48:19 -0000 1.3 *************** *** 31,35 **** #region FIELDS - private int length; private TlsProtocol protocol; private byte[] random; --- 31,34 ---- *************** *** 42,47 **** #region CONSTRUCTORS ! public TlsServerHello(TlsSession session, TlsStreamReader reader) ! : base(session, TlsHandshakeType.ServerHello, reader) { } --- 41,46 ---- #region CONSTRUCTORS ! public TlsServerHello(TlsSession session, byte[] buffer) ! : base(session, TlsHandshakeType.ServerHello, buffer) { } *************** *** 69,86 **** { // Read protocol version ! this.protocol = (TlsProtocol)Reader.ReadShort(); // Read random - Unix time + Random bytes ! this.random = Reader.ReadBytes(32); // Read Session id ! int length = (int)Reader.ReadByte(); if (length > 0) { ! this.sessionId = Reader.ReadBytes(length); } // Read cipher suite ! short cipherCode = Reader.ReadShort(); if (Session.SupportedCiphers.IndexOf(cipherCode) == -1) { --- 68,85 ---- { // Read protocol version ! this.protocol = (TlsProtocol)ReadInt16(); // Read random - Unix time + Random bytes ! this.random = ReadBytes(32); // Read Session id ! int length = (int)ReadByte(); if (length > 0) { ! this.sessionId = ReadBytes(length); } // Read cipher suite ! short cipherCode = ReadInt16(); if (Session.SupportedCiphers.IndexOf(cipherCode) == -1) { *************** *** 91,95 **** // Read compression methods ( always 0 ) ! compressionMethod = Reader.ReadByte(); } --- 90,94 ---- // Read compression methods ( always 0 ) ! compressionMethod = ReadByte(); } Index: TlsServerHelloDone.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/TlsServerHelloDone.cs,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** TlsServerHelloDone.cs 13 Oct 2003 19:15:13 -0000 1.2 --- TlsServerHelloDone.cs 13 Oct 2003 20:48:19 -0000 1.3 *************** *** 31,36 **** #region CONSTRUCTORS ! public TlsServerHelloDone(TlsSession session, TlsStreamReader reader) ! : base(session, TlsHandshakeType.ServerHello, reader) { } --- 31,36 ---- #region CONSTRUCTORS ! public TlsServerHelloDone(TlsSession session, byte[] buffer) ! : base(session, TlsHandshakeType.ServerHello, buffer) { } Index: TlsServerKeyExchange.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/TlsServerKeyExchange.cs,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** TlsServerKeyExchange.cs 13 Oct 2003 19:15:13 -0000 1.2 --- TlsServerKeyExchange.cs 13 Oct 2003 20:48:19 -0000 1.3 *************** *** 40,45 **** #region CONSTRUCTORS ! public TlsServerKeyExchange(TlsSession session, TlsStreamReader reader) ! : base(session, TlsHandshakeType.ServerKeyExchange, reader) { verify(); --- 40,45 ---- #region CONSTRUCTORS ! public TlsServerKeyExchange(TlsSession session, byte[] buffer) ! : base(session, TlsHandshakeType.ServerKeyExchange, buffer) { verify(); *************** *** 68,81 **** // Read modulus ! int length = Reader.ReadShort(); ! rsaParams.Modulus = Reader.ReadBytes(length); // Read exponent ! length = Reader.ReadShort(); ! rsaParams.Exponent = Reader.ReadBytes(length); // Read signed params ! length = Reader.ReadShort(); ! signedParams = Reader.ReadBytes(length); } --- 68,81 ---- // Read modulus ! short length = ReadInt16(); ! rsaParams.Modulus = ReadBytes(length); // Read exponent ! length = ReadInt16(); ! rsaParams.Exponent = ReadBytes(length); // Read signed params ! length = ReadInt16(); ! signedParams = ReadBytes(length); } |