pgsqlclient-checkins Mailing List for PostgreSqlClient (Page 39)
Status: Inactive
Brought to you by:
carlosga_fb
You can subscribe to this list here.
2003 |
Jan
|
Feb
|
Mar
|
Apr
|
May
|
Jun
|
Jul
(120) |
Aug
(95) |
Sep
(95) |
Oct
(213) |
Nov
(114) |
Dec
(64) |
---|---|---|---|---|---|---|---|---|---|---|---|---|
2004 |
Jan
(6) |
Feb
(134) |
Mar
(88) |
Apr
(28) |
May
(22) |
Jun
(15) |
Jul
(23) |
Aug
(2) |
Sep
(15) |
Oct
(2) |
Nov
(6) |
Dec
|
2005 |
Jan
(8) |
Feb
(6) |
Mar
|
Apr
(42) |
May
(3) |
Jun
|
Jul
|
Aug
|
Sep
(84) |
Oct
|
Nov
|
Dec
|
2006 |
Jan
|
Feb
|
Mar
(84) |
Apr
(46) |
May
(40) |
Jun
(8) |
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
From: <car...@us...> - 2003-10-14 10:13:46
|
Update of /cvsroot/pgsqlclient/pgsqlclient_10/Mono.Security.Protocol.Tls/Mono.Security.Protocol.Tls In directory sc8-pr-cvs1:/tmp/cvs-serv3994 Removed Files: TlsStreamReader.cs TlsStreamWriter.cs Log Message: TlsStreamReader and TlsStreamWriter classes are replaced by TlStream class. --- TlsStreamReader.cs DELETED --- --- TlsStreamWriter.cs DELETED --- |
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-serv32327 Modified Files: TlsClientHello.cs Log Message: Added new TlsStream class. TlsStreamReader and TlsStreamWriter will be replaced by this class soon. TlsHandhskaeMessage inherits from this class. 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.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** TlsClientHello.cs 13 Oct 2003 20:48:19 -0000 1.2 --- TlsClientHello.cs 14 Oct 2003 09:49:02 -0000 1.3 *************** *** 66,84 **** // Client Version Write((short)Session.Context.Protocol); ! ! // Random bytes - Unix time + Radom bytes ! TlsStreamWriter rnd = new TlsStreamWriter(); ! // Unix Time ! rnd.WriteInt(GetUnixTime()); ! // Random bytes ! byte[] r = new byte[28]; ! RNGCryptoServiceProvider rng = new RNGCryptoServiceProvider(); ! rng.GetNonZeroBytes(r); ! rnd.Write(r); ! Write(rnd.GetBytes()); ! ! random = rnd.GetBytes(); ! rnd.Reset(); // Session id --- 66,78 ---- // 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(); ! Write(this.random); // Session id |
From: <car...@us...> - 2003-10-14 09:48:27
|
Update of /cvsroot/pgsqlclient/pgsqlclient_10/Mono.Security.Protocol.Tls/Mono.Security.Protocol.Tls/Mono.Security.Protocol.Tls.Handshake In directory sc8-pr-cvs1:/tmp/cvs-serv32207 Modified Files: TlsHandshakeMessage.cs Log Message: Added new TlsStream class. TlsStreamReader and TlsStreamWriter will be replaced by this class soon. TlsHandhskaeMessage inherits from this class. Index: TlsHandshakeMessage.cs =================================================================== RCS file: /cvsroot/pgsqlclient/pgsqlclient_10/Mono.Security.Protocol.Tls/Mono.Security.Protocol.Tls/Mono.Security.Protocol.Tls.Handshake/TlsHandshakeMessage.cs,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** TlsHandshakeMessage.cs 13 Oct 2003 20:48:03 -0000 1.3 --- TlsHandshakeMessage.cs 14 Oct 2003 09:48:22 -0000 1.4 *************** *** 24,34 **** using System; ! using System.IO; ! using System.Net; namespace Mono.Security.Protocol.Tls.Handshake { ! #warning "Think on implement a base stream class with the same stream methods as this have and remove TlsStreamReader and TlsStreamWriter classes" ! internal class TlsHandshakeMessage : Stream { #region FIELDS --- 24,32 ---- using System; ! // using Mono.Security.Protocol.Tls; namespace Mono.Security.Protocol.Tls.Handshake { ! internal class TlsHandshakeMessage : TlsStream { #region FIELDS *************** *** 37,73 **** private TlsHandshakeType handshakeType; private TlsContentType contentType; - private bool canRead; - private bool canWrite; - private MemoryStream buffer; - - #endregion - - #region STREAM_PROPERTIES - - public override bool CanWrite - { - get { return canWrite; } - } - - public override bool CanRead - { - get { return canRead; } - } - - public override bool CanSeek - { - get { return buffer.CanSeek; } - } - - public override long Position - { - get { return buffer.Position; } - set { buffer.Position = value; } - } - - public override long Length - { - get { return buffer.Length; } - } #endregion --- 35,38 ---- *************** *** 94,116 **** #region CONSTRUCTORS - private TlsHandshakeMessage() : base() - { - this.buffer = new MemoryStream(0); - } - - private TlsHandshakeMessage(byte[] data) : base() - { - this.buffer = new MemoryStream(data, false); - } - public TlsHandshakeMessage(TlsSession session, TlsHandshakeType handshakeType, ! TlsContentType contentType) : this() { this.session = session; this.handshakeType = handshakeType; this.contentType = contentType; - this.canRead = false; - this.canWrite = true; // Fill message contents --- 59,69 ---- #region CONSTRUCTORS public TlsHandshakeMessage(TlsSession session, TlsHandshakeType handshakeType, ! TlsContentType contentType) : base() { this.session = session; this.handshakeType = handshakeType; this.contentType = contentType; // Fill message contents *************** *** 119,128 **** public TlsHandshakeMessage(TlsSession session, ! TlsHandshakeType handshakeType, byte[] data) : this(data) { this.session = session; this.handshakeType = handshakeType; - this.canRead = true; - this.canWrite = false; // Parse message --- 72,79 ---- public TlsHandshakeMessage(TlsSession session, ! TlsHandshakeType handshakeType, byte[] data) : base(data) { this.session = session; this.handshakeType = handshakeType; // Parse message *************** *** 132,267 **** #endregion - #region SPECIFIC_READ_METHODS - - public new byte ReadByte() - { - return (byte)base.ReadByte(); - } - - public short ReadInt16() - { - byte[] bytes = this.ReadBytes(2); - - return IPAddress.HostToNetworkOrder(BitConverter.ToInt16(bytes, 0)); - } - - public int ReadInt24() - { - byte[] b = this.ReadBytes(3); - - return ((b[0] & 0xff) << 16) | ((b[1] & 0xff) << 8) | (b[2] & 0xff); - } - - public int ReadInt32() - { - byte[] bytes = this.ReadBytes(4); - - return IPAddress.HostToNetworkOrder(BitConverter.ToInt32(bytes, 0)); - } - - public long ReadInt64() - { - byte[] bytes = this.ReadBytes(8); - - return IPAddress.HostToNetworkOrder(BitConverter.ToInt64(bytes, 0)); - } - - public byte[] ReadBytes(int count) - { - byte[] bytes = new byte[count]; - this.Read(bytes, 0, count); - - return bytes; - } - - #endregion - - #region SPECIFIC_WRITE_METHODS - - public void Write(byte value) - { - WriteByte(value); - } - - public void Write(short value) - { - byte[] bytes = BitConverter.GetBytes((short)IPAddress.HostToNetworkOrder(value)); - Write(bytes); - } - - public void WriteInt24(int value) - { - int int24 = IPAddress.HostToNetworkOrder(value); - byte[] content = new byte[3]; - - System.Array.Copy(BitConverter.GetBytes(int24), 1, content, 0, 3); - - Write(content); - } - - public void Write(int value) - { - byte[] bytes = BitConverter.GetBytes((int)IPAddress.HostToNetworkOrder(value)); - Write(bytes); - } - - public void Write(long value) - { - byte[] bytes = BitConverter.GetBytes((long)IPAddress.HostToNetworkOrder(value)); - Write(bytes); - } - - public void Write(byte[] buffer) - { - Write(buffer, 0, buffer.Length); - } - - #endregion - - #region STREAM_METHODS - - public override void Flush() - { - buffer.Flush(); - } - - public override void SetLength(long length) - { - buffer.SetLength(length); - } - - public override long Seek(long offset, System.IO.SeekOrigin loc) - { - return buffer.Seek(offset, loc); - } - - public override int Read(byte[] buffer, int offset, int count) - { - if (canRead) - { - return this.buffer.Read(buffer, offset, count); - } - throw new InvalidOperationException("Read operations are not allowed by this stream"); - } - - public override void Write(byte[] buffer, int offset, int count) - { - if (canWrite) - { - this.buffer.Write(buffer, offset, count); - } - else - { - throw new InvalidOperationException("Write operations are not allowed by this stream"); - } - } - - #endregion - #region METHODS public virtual void UpdateSession() { ! if (canWrite) { this.session.Context.HandshakeHashes.Update(this.EncodeMessage()); --- 83,91 ---- #endregion #region METHODS public virtual void UpdateSession() { ! if (CanWrite) { this.session.Context.HandshakeHashes.Update(this.EncodeMessage()); *************** *** 282,286 **** byte[] result = null; ! if (canWrite) { TlsStreamWriter c = new TlsStreamWriter(); --- 106,110 ---- byte[] result = null; ! if (CanWrite) { TlsStreamWriter c = new TlsStreamWriter(); *************** *** 288,292 **** c.Write((byte)HandshakeType); c.WriteInt24((int)Length); ! c.Write(buffer.ToArray()); result = c.GetBytes(); --- 112,116 ---- c.Write((byte)HandshakeType); c.WriteInt24((int)Length); ! c.Write(ToArray()); result = c.GetBytes(); *************** *** 294,311 **** return result; - } - - protected int GetUnixTime() - { - DateTime now = DateTime.Now.ToUniversalTime(); - TimeSpan unixTime = now.Subtract(new DateTime(1970, 1, 1)); - - return (int)unixTime.TotalSeconds; - } - - public void Reset() - { - buffer.SetLength(0); - buffer.Position = 0; } --- 118,121 ---- |
From: <car...@us...> - 2003-10-14 09:48:05
|
Update of /cvsroot/pgsqlclient/pgsqlclient_10/Mono.Security.Protocol.Tls/Mono.Security.Protocol.Tls In directory sc8-pr-cvs1:/tmp/cvs-serv32059 Modified Files: TlsSessionContext.cs Log Message: - Added methods GetUnixTime and GetSecureRandomBytes. Index: TlsSessionContext.cs =================================================================== RCS file: /cvsroot/pgsqlclient/pgsqlclient_10/Mono.Security.Protocol.Tls/Mono.Security.Protocol.Tls/TlsSessionContext.cs,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** TlsSessionContext.cs 13 Oct 2003 19:13:30 -0000 1.2 --- TlsSessionContext.cs 14 Oct 2003 09:48:01 -0000 1.3 *************** *** 194,197 **** --- 194,215 ---- #region KEY_GENERATION_METODS + public byte[] GetSecureRandomBytes(int count) + { + byte[] secureBytes = new byte[count]; + + RNGCryptoServiceProvider rng = new RNGCryptoServiceProvider(); + rng.GetNonZeroBytes(secureBytes); + + return secureBytes; + } + + public int GetUnixTime() + { + DateTime now = DateTime.Now.ToUniversalTime(); + TimeSpan unixTime = now.Subtract(new DateTime(1970, 1, 1)); + + return (int)unixTime.TotalSeconds; + } + public byte[] CreatePremasterSecret() { *************** *** 199,209 **** // Write protocol version ! stream.WriteShort((short)TlsProtocol.Tls1); // Generate random bytes ! byte[] random = new byte[46]; ! RNGCryptoServiceProvider rng = new RNGCryptoServiceProvider(); ! rng.GetNonZeroBytes(random); ! stream.Write(random); byte[] preMasterSecret = stream.GetBytes(); --- 217,224 ---- // Write protocol version ! stream.WriteShort((short)protocol); // Generate random bytes ! stream.Write(GetSecureRandomBytes(46)); byte[] preMasterSecret = stream.GetBytes(); |
From: <car...@us...> - 2003-10-14 09:46:23
|
Update of /cvsroot/pgsqlclient/pgsqlclient_10/Mono.Security.Protocol.Tls/Mono.Security.Protocol.Tls In directory sc8-pr-cvs1:/tmp/cvs-serv31855 Added Files: TlsStream.cs Log Message: Added new TlsStream class. TlsStreamReader and TlsStreamWriter will be replaced by this class soon. TlsHandhskaeMessage inherits from this class. --- NEW FILE: TlsStream.cs --- using System; using System.IO; using System.Net; namespace Mono.Security.Protocol.Tls { internal class TlsStream : Stream { #region FIELDS private bool canRead; private bool canWrite; private MemoryStream buffer; #endregion #region STREAM_PROPERTIES public override bool CanWrite { get { return canWrite; } } public override bool CanRead { get { return canRead; } } public override bool CanSeek { get { return buffer.CanSeek; } } public override long Position { get { return buffer.Position; } set { buffer.Position = value; } } public override long Length { get { return buffer.Length; } } #endregion #region CONSTRUCTORS public TlsStream() : base() { this.buffer = new MemoryStream(0); this.canRead = false; this.canWrite = true; } public TlsStream(byte[] data) : base() { this.buffer = new MemoryStream(data, false); this.canRead = true; this.canWrite = false; } #endregion #region SPECIFIC_READ_METHODS public new byte ReadByte() { return (byte)base.ReadByte(); } public short ReadInt16() { byte[] bytes = this.ReadBytes(2); return IPAddress.HostToNetworkOrder(BitConverter.ToInt16(bytes, 0)); } public int ReadInt24() { byte[] b = this.ReadBytes(3); return ((b[0] & 0xff) << 16) | ((b[1] & 0xff) << 8) | (b[2] & 0xff); } public int ReadInt32() { byte[] bytes = this.ReadBytes(4); return IPAddress.HostToNetworkOrder(BitConverter.ToInt32(bytes, 0)); } public long ReadInt64() { byte[] bytes = this.ReadBytes(8); return IPAddress.HostToNetworkOrder(BitConverter.ToInt64(bytes, 0)); } public byte[] ReadBytes(int count) { byte[] bytes = new byte[count]; this.Read(bytes, 0, count); return bytes; } #endregion #region SPECIFIC_WRITE_METHODS public void Write(byte value) { WriteByte(value); } public void Write(short value) { byte[] bytes = BitConverter.GetBytes((short)IPAddress.HostToNetworkOrder(value)); Write(bytes); } public void WriteInt24(int value) { int int24 = IPAddress.HostToNetworkOrder(value); byte[] content = new byte[3]; System.Array.Copy(BitConverter.GetBytes(int24), 1, content, 0, 3); Write(content); } public void Write(int value) { byte[] bytes = BitConverter.GetBytes((int)IPAddress.HostToNetworkOrder(value)); Write(bytes); } public void Write(long value) { byte[] bytes = BitConverter.GetBytes((long)IPAddress.HostToNetworkOrder(value)); Write(bytes); } public void Write(byte[] buffer) { Write(buffer, 0, buffer.Length); } #endregion #region METHODS public void Reset() { buffer.SetLength(0); buffer.Position = 0; } public byte[] ToArray() { return buffer.ToArray(); } #endregion #region STREAM_METHODS public override void Flush() { buffer.Flush(); } public override void SetLength(long length) { buffer.SetLength(length); } public override long Seek(long offset, System.IO.SeekOrigin loc) { return buffer.Seek(offset, loc); } public override int Read(byte[] buffer, int offset, int count) { if (canRead) { return this.buffer.Read(buffer, offset, count); } throw new InvalidOperationException("Read operations are not allowed by this stream"); } public override void Write(byte[] buffer, int offset, int count) { if (canWrite) { this.buffer.Write(buffer, offset, count); } else { throw new InvalidOperationException("Write operations are not allowed by this stream"); } } #endregion } } |
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); } |
From: <car...@us...> - 2003-10-13 20:48:14
|
Update of /cvsroot/pgsqlclient/pgsqlclient_10/Mono.Security.Protocol.Tls/Mono.Security.Protocol.Tls/Mono.Security.Protocol.Tls.Handshake In directory sc8-pr-cvs1:/tmp/cvs-serv1430 Modified Files: TlsHandshakeMessage.cs Log Message: Added more enhacements to the Handshake protocol Index: TlsHandshakeMessage.cs =================================================================== RCS file: /cvsroot/pgsqlclient/pgsqlclient_10/Mono.Security.Protocol.Tls/Mono.Security.Protocol.Tls/Mono.Security.Protocol.Tls.Handshake/TlsHandshakeMessage.cs,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** TlsHandshakeMessage.cs 13 Oct 2003 19:13:55 -0000 1.2 --- TlsHandshakeMessage.cs 13 Oct 2003 20:48:03 -0000 1.3 *************** *** 24,32 **** using System; namespace Mono.Security.Protocol.Tls.Handshake { ! #warning "Think on change this for inherit from Stream" ! internal class TlsHandshakeMessage { #region FIELDS --- 24,34 ---- using System; + using System.IO; + using System.Net; namespace Mono.Security.Protocol.Tls.Handshake { ! #warning "Think on implement a base stream class with the same stream methods as this have and remove TlsStreamReader and TlsStreamWriter classes" ! internal class TlsHandshakeMessage : Stream { #region FIELDS *************** *** 37,42 **** private bool canRead; private bool canWrite; ! private TlsStreamReader reader; ! private TlsStreamWriter writer; #endregion --- 39,73 ---- private bool canRead; private bool canWrite; ! private MemoryStream buffer; ! ! #endregion ! ! #region STREAM_PROPERTIES ! ! public override bool CanWrite ! { ! get { return canWrite; } ! } ! ! public override bool CanRead ! { ! get { return canRead; } ! } ! ! public override bool CanSeek ! { ! get { return buffer.CanSeek; } ! } ! ! public override long Position ! { ! get { return buffer.Position; } ! set { buffer.Position = value; } ! } ! ! public override long Length ! { ! get { return buffer.Length; } ! } #endregion *************** *** 59,90 **** } ! public TlsStreamReader Reader ! { ! get ! { ! if (canRead) ! { ! return reader; ! } ! throw new InvalidOperationException(); ! } ! } ! public TlsStreamWriter Writer { ! get ! { ! if (canWrite) ! { ! return writer; ! } ! throw new InvalidOperationException(); ! } } ! #endregion ! ! public TlsHandshakeMessage() { } --- 90,105 ---- } ! #endregion ! #region CONSTRUCTORS ! ! private TlsHandshakeMessage() : base() { ! this.buffer = new MemoryStream(0); } ! private TlsHandshakeMessage(byte[] data) : base() { + this.buffer = new MemoryStream(data, false); } *************** *** 96,102 **** this.handshakeType = handshakeType; this.contentType = contentType; - this.writer = new TlsStreamWriter(); this.canRead = false; ! this.canWrite = true; // Fill message contents --- 111,116 ---- this.handshakeType = handshakeType; this.contentType = contentType; this.canRead = false; ! this.canWrite = true; // Fill message contents *************** *** 105,121 **** public TlsHandshakeMessage(TlsSession session, ! TlsHandshakeType handshakeType, ! TlsStreamReader reader) { this.session = session; this.handshakeType = handshakeType; - this.reader = reader; this.canRead = true; this.canWrite = false; ! // Parse message this.Parse(); } public virtual void UpdateSession() { --- 119,264 ---- public TlsHandshakeMessage(TlsSession session, ! TlsHandshakeType handshakeType, byte[] data) : this(data) { this.session = session; this.handshakeType = handshakeType; this.canRead = true; this.canWrite = false; ! // Parse message this.Parse(); } + #endregion + + #region SPECIFIC_READ_METHODS + + public new byte ReadByte() + { + return (byte)base.ReadByte(); + } + + public short ReadInt16() + { + byte[] bytes = this.ReadBytes(2); + + return IPAddress.HostToNetworkOrder(BitConverter.ToInt16(bytes, 0)); + } + + public int ReadInt24() + { + byte[] b = this.ReadBytes(3); + + return ((b[0] & 0xff) << 16) | ((b[1] & 0xff) << 8) | (b[2] & 0xff); + } + + public int ReadInt32() + { + byte[] bytes = this.ReadBytes(4); + + return IPAddress.HostToNetworkOrder(BitConverter.ToInt32(bytes, 0)); + } + + public long ReadInt64() + { + byte[] bytes = this.ReadBytes(8); + + return IPAddress.HostToNetworkOrder(BitConverter.ToInt64(bytes, 0)); + } + + public byte[] ReadBytes(int count) + { + byte[] bytes = new byte[count]; + this.Read(bytes, 0, count); + + return bytes; + } + + #endregion + + #region SPECIFIC_WRITE_METHODS + + public void Write(byte value) + { + WriteByte(value); + } + + public void Write(short value) + { + byte[] bytes = BitConverter.GetBytes((short)IPAddress.HostToNetworkOrder(value)); + Write(bytes); + } + + public void WriteInt24(int value) + { + int int24 = IPAddress.HostToNetworkOrder(value); + byte[] content = new byte[3]; + + System.Array.Copy(BitConverter.GetBytes(int24), 1, content, 0, 3); + + Write(content); + } + + public void Write(int value) + { + byte[] bytes = BitConverter.GetBytes((int)IPAddress.HostToNetworkOrder(value)); + Write(bytes); + } + + public void Write(long value) + { + byte[] bytes = BitConverter.GetBytes((long)IPAddress.HostToNetworkOrder(value)); + Write(bytes); + } + + public void Write(byte[] buffer) + { + Write(buffer, 0, buffer.Length); + } + + #endregion + + #region STREAM_METHODS + + public override void Flush() + { + buffer.Flush(); + } + + public override void SetLength(long length) + { + buffer.SetLength(length); + } + + public override long Seek(long offset, System.IO.SeekOrigin loc) + { + return buffer.Seek(offset, loc); + } + + public override int Read(byte[] buffer, int offset, int count) + { + if (canRead) + { + return this.buffer.Read(buffer, offset, count); + } + throw new InvalidOperationException("Read operations are not allowed by this stream"); + } + + public override void Write(byte[] buffer, int offset, int count) + { + if (canWrite) + { + this.buffer.Write(buffer, offset, count); + } + else + { + throw new InvalidOperationException("Write operations are not allowed by this stream"); + } + } + + #endregion + + #region METHODS + public virtual void UpdateSession() { *************** *** 144,149 **** c.Write((byte)HandshakeType); ! c.WriteInt24((int)writer.Length); ! c.Write(writer.GetBytes()); result = c.GetBytes(); --- 287,292 ---- c.Write((byte)HandshakeType); ! c.WriteInt24((int)Length); ! c.Write(buffer.ToArray()); result = c.GetBytes(); *************** *** 163,175 **** public void Reset() { ! if (canWrite) ! { ! writer.Reset(); ! } ! if (canRead) ! { ! reader.Reset(); ! } } } } --- 306,314 ---- public void Reset() { ! buffer.SetLength(0); ! buffer.Position = 0; } + + #endregion } } |
From: <car...@us...> - 2003-10-13 20:47:16
|
Update of /cvsroot/pgsqlclient/pgsqlclient_10/Mono.Security.Protocol.Tls/Mono.Security.Protocol.Tls In directory sc8-pr-cvs1:/tmp/cvs-serv1261 Modified Files: TlsSocket.cs Log Message: Added more enhacements to the Handshake protocol Index: TlsSocket.cs =================================================================== RCS file: /cvsroot/pgsqlclient/pgsqlclient_10/Mono.Security.Protocol.Tls/Mono.Security.Protocol.Tls/TlsSocket.cs,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** TlsSocket.cs 13 Oct 2003 19:13:30 -0000 1.2 --- TlsSocket.cs 13 Oct 2003 20:47:11 -0000 1.3 *************** *** 465,475 **** // Read message data - /* byte[] data = new byte[length]; handMsg.Read(data, 0, length); - */ // Create and process the server message ! message = createServerHandshakeMessage(handshakeType, handMsg); // Update session --- 465,473 ---- // Read message data byte[] data = new byte[length]; handMsg.Read(data, 0, length); // Create and process the server message ! message = createServerHandshakeMessage(handshakeType, data); // Update session *************** *** 596,600 **** { // Reset isSecure field ! session.IsSecure = false; // Send client hello --- 594,598 ---- { // Reset isSecure field ! this.session.IsSecure = false; // Send client hello *************** *** 618,622 **** // Now initialize session cipher with the generated keys ! session.Context.Cipher.InitializeCipher(); // Send certificate verify if requested --- 616,620 ---- // Now initialize session cipher with the generated keys ! this.session.Context.Cipher.InitializeCipher(); // Send certificate verify if requested *************** *** 639,646 **** // Clear Key Info ! session.Context.ClearKeyInfo(); // Set isSecure ! session.IsSecure = true; } --- 637,644 ---- // Clear Key Info ! this.session.Context.ClearKeyInfo(); // Set isSecure ! this.session.IsSecure = true; } *************** *** 669,673 **** } ! private TlsHandshakeMessage createServerHandshakeMessage(TlsHandshakeType type, TlsStreamReader handMsg) { switch (type) --- 667,671 ---- } ! private TlsHandshakeMessage createServerHandshakeMessage(TlsHandshakeType type, byte[] buffer) { switch (type) *************** *** 678,697 **** case TlsHandshakeType.ServerHello: ! return new TlsServerHello(session, handMsg); case TlsHandshakeType.Certificate: ! return new TlsServerCertificate(session, handMsg); case TlsHandshakeType.ServerKeyExchange: ! return new TlsServerKeyExchange(session, handMsg); case TlsHandshakeType.CertificateRequest: ! return new TlsServerCertificateRequest(session, handMsg); case TlsHandshakeType.ServerHelloDone: ! return new TlsServerHelloDone(session, handMsg); case TlsHandshakeType.Finished: ! return new TlsServerFinished(session, handMsg); default: --- 676,695 ---- case TlsHandshakeType.ServerHello: ! return new TlsServerHello(session, buffer); case TlsHandshakeType.Certificate: ! return new TlsServerCertificate(session, buffer); case TlsHandshakeType.ServerKeyExchange: ! return new TlsServerKeyExchange(session, buffer); case TlsHandshakeType.CertificateRequest: ! return new TlsServerCertificateRequest(session, buffer); case TlsHandshakeType.ServerHelloDone: ! return new TlsServerHelloDone(session, buffer); case TlsHandshakeType.Finished: ! return new TlsServerFinished(session, buffer); default: |
From: <car...@us...> - 2003-10-13 19:15:18
|
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-serv15018 Modified Files: TlsServerCertificate.cs TlsServerCertificateRequest.cs TlsServerFinished.cs TlsServerHello.cs TlsServerHelloDone.cs TlsServerKeyExchange.cs Log Message: Added some improvements to the Handshake layer 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.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** TlsServerCertificate.cs 11 Oct 2003 10:09:37 -0000 1.1 --- TlsServerCertificate.cs 13 Oct 2003 19:15:13 -0000 1.2 *************** *** 72,82 **** { this.certificates = new X509CertificateCollection(); ! ! // Skip first 3 bytes ! int skip = Reader.ReadInt24(); int readed = 0; ! ! // Read Length ! int length = Reader.ReadInt24(); while (readed < length) --- 72,78 ---- { this.certificates = new X509CertificateCollection(); ! int readed = 0; ! int length = Reader.ReadInt24(); while (readed < length) 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.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** TlsServerCertificateRequest.cs 11 Oct 2003 10:09:37 -0000 1.1 --- TlsServerCertificateRequest.cs 13 Oct 2003 19:15:13 -0000 1.2 *************** *** 64,69 **** protected override void Parse() { - int length = Reader.ReadInt24(); - // Read requested certificate types int typesCount = Reader.ReadByte(); --- 64,67 ---- *************** *** 76,91 **** } - // Read requested certificate authorities (Distinguised Names) - /* ! Name ::= SEQUENCE OF RelativeDistinguishedName ! ! RelativeDistinguishedName ::= SET OF AttributeValueAssertion ! ! AttributeValueAssertion ::= SEQUENCE { ! attributeType OBJECT IDENTIFIER ! attributeValue ANY } ! */ ! int tmp = Reader.ReadShort(); ASN1 rdn = new ASN1(Reader.ReadBytes(Reader.ReadShort())); --- 74,88 ---- } /* ! * Read requested certificate authorities (Distinguised Names) ! * ! * Name ::= SEQUENCE OF RelativeDistinguishedName ! * ! * RelativeDistinguishedName ::= SET OF AttributeValueAssertion ! * ! * AttributeValueAssertion ::= SEQUENCE { ! * attributeType OBJECT IDENTIFIER ! * attributeValue ANY } ! */ int tmp = Reader.ReadShort(); ASN1 rdn = new ASN1(Reader.ReadBytes(Reader.ReadShort())); 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.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** TlsServerFinished.cs 11 Oct 2003 10:09:37 -0000 1.1 --- TlsServerFinished.cs 13 Oct 2003 19:15:13 -0000 1.2 *************** *** 50,61 **** #endregion ! #region PRIVATE_METHOD protected override void Parse() { ! int length = Reader.ReadInt24(); ! byte[] serverPRF = Reader.ReadBytes(length); ! ! TlsStreamWriter hashes = new TlsStreamWriter(); hashes.Write(Session.Context.HandshakeHashes.GetMD5Hash()); --- 50,59 ---- #endregion ! #region PROTECTED_METHODS protected override void Parse() { ! byte[] serverPRF = Reader.ReadBytes((int)Reader.Length); ! TlsStreamWriter hashes = new TlsStreamWriter(); hashes.Write(Session.Context.HandshakeHashes.GetMD5Hash()); 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.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** TlsServerHello.cs 11 Oct 2003 10:09:37 -0000 1.1 --- TlsServerHello.cs 13 Oct 2003 19:15:13 -0000 1.2 *************** *** 68,74 **** protected override void Parse() { - // Read message length - this.length = Reader.ReadInt24(); - // Read protocol version this.protocol = (TlsProtocol)Reader.ReadShort(); --- 68,71 ---- 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.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** TlsServerHelloDone.cs 11 Oct 2003 10:09:37 -0000 1.1 --- TlsServerHelloDone.cs 13 Oct 2003 19:15:13 -0000 1.2 *************** *** 53,57 **** protected override void Parse() { - int length = Reader.ReadInt24(); } --- 53,56 ---- 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.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** TlsServerKeyExchange.cs 11 Oct 2003 10:09:37 -0000 1.1 --- TlsServerKeyExchange.cs 13 Oct 2003 19:15:13 -0000 1.2 *************** *** 65,74 **** protected override void Parse() { - int length = Reader.ReadInt24(); - rsaParams = new RSAParameters(); // Read modulus ! length = Reader.ReadShort(); rsaParams.Modulus = Reader.ReadBytes(length); --- 65,72 ---- protected override void Parse() { rsaParams = new RSAParameters(); // Read modulus ! int length = Reader.ReadShort(); rsaParams.Modulus = Reader.ReadBytes(length); |
From: <car...@us...> - 2003-10-13 19:13:59
|
Update of /cvsroot/pgsqlclient/pgsqlclient_10/Mono.Security.Protocol.Tls/Mono.Security.Protocol.Tls/Mono.Security.Protocol.Tls.Handshake In directory sc8-pr-cvs1:/tmp/cvs-serv13925 Modified Files: TlsHandshakeMessage.cs Log Message: Added some improvements to the Handshake layer Index: TlsHandshakeMessage.cs =================================================================== RCS file: /cvsroot/pgsqlclient/pgsqlclient_10/Mono.Security.Protocol.Tls/Mono.Security.Protocol.Tls/Mono.Security.Protocol.Tls.Handshake/TlsHandshakeMessage.cs,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** TlsHandshakeMessage.cs 11 Oct 2003 10:08:57 -0000 1.1 --- TlsHandshakeMessage.cs 13 Oct 2003 19:13:55 -0000 1.2 *************** *** 28,32 **** { #warning "Think on change this for inherit from Stream" ! internal abstract class TlsHandshakeMessage { #region FIELDS --- 28,32 ---- { #warning "Think on change this for inherit from Stream" ! internal class TlsHandshakeMessage { #region FIELDS |
Update of /cvsroot/pgsqlclient/pgsqlclient_10/Mono.Security.Protocol.Tls/Mono.Security.Protocol.Tls In directory sc8-pr-cvs1:/tmp/cvs-serv13804 Modified Files: TlsCipherSuite.cs TlsSession.cs TlsSessionContext.cs TlsSocket.cs Log Message: Added some improvements to the Handshake layer Index: TlsCipherSuite.cs =================================================================== RCS file: /cvsroot/pgsqlclient/pgsqlclient_10/Mono.Security.Protocol.Tls/Mono.Security.Protocol.Tls/TlsCipherSuite.cs,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** TlsCipherSuite.cs 11 Oct 2003 10:04:20 -0000 1.1 --- TlsCipherSuite.cs 13 Oct 2003 19:13:30 -0000 1.2 *************** *** 241,245 **** cs.WriteByte((byte)paddingLength); } ! cs.Close(); return ms.ToArray(); --- 241,246 ---- cs.WriteByte((byte)paddingLength); } ! //cs.FlushFinalBlock(); ! cs.Close(); return ms.ToArray(); Index: TlsSession.cs =================================================================== RCS file: /cvsroot/pgsqlclient/pgsqlclient_10/Mono.Security.Protocol.Tls/Mono.Security.Protocol.Tls/TlsSession.cs,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** TlsSession.cs 11 Oct 2003 10:04:20 -0000 1.1 --- TlsSession.cs 13 Oct 2003 19:13:30 -0000 1.2 *************** *** 65,68 **** --- 65,82 ---- } + public TlsNetworkStream NetworkStream + { + get { return networkStream; } + } + + public TlsSessionState State + { + get { return state; } + } + + #endregion + + #region INTERNAL_PROPERTIES + internal TlsSessionContext Context { *************** *** 101,114 **** { get { return (short)Math.Pow(2, 14); } - } - - public TlsNetworkStream NetworkStream - { - get { return networkStream; } - } - - public TlsSessionState State - { - get { return state; } } --- 115,118 ---- Index: TlsSessionContext.cs =================================================================== RCS file: /cvsroot/pgsqlclient/pgsqlclient_10/Mono.Security.Protocol.Tls/Mono.Security.Protocol.Tls/TlsSessionContext.cs,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** TlsSessionContext.cs 11 Oct 2003 10:04:20 -0000 1.1 --- TlsSessionContext.cs 13 Oct 2003 19:13:30 -0000 1.2 *************** *** 387,391 **** serverWriteMAC = null; ! // Force the GC to recollect the memry ?? } --- 387,391 ---- serverWriteMAC = null; ! // Force the GC to recollect the memory ?? } Index: TlsSocket.cs =================================================================== RCS file: /cvsroot/pgsqlclient/pgsqlclient_10/Mono.Security.Protocol.Tls/Mono.Security.Protocol.Tls/TlsSocket.cs,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** TlsSocket.cs 11 Oct 2003 10:04:20 -0000 1.1 --- TlsSocket.cs 13 Oct 2003 19:13:30 -0000 1.2 *************** *** 458,464 **** private void processHandshakeMessage(TlsStreamReader handMsg) { ! TlsHandshakeType handshakeType = (TlsHandshakeType)handMsg.ReadByte(); TlsHandshakeMessage message = null; message = createServerHandshakeMessage(handshakeType, handMsg); --- 458,474 ---- private void processHandshakeMessage(TlsStreamReader handMsg) { ! TlsHandshakeType handshakeType = (TlsHandshakeType)handMsg.ReadByte(); TlsHandshakeMessage message = null; + // Read message length + int length = handMsg.ReadInt24(); + + // Read message data + /* + byte[] data = new byte[length]; + handMsg.Read(data, 0, length); + */ + + // Create and process the server message message = createServerHandshakeMessage(handshakeType, handMsg); |
From: <car...@us...> - 2003-10-11 10:12:23
|
Update of /cvsroot/pgsqlclient/pgsqlclient_10/WindowsSetup In directory sc8-pr-cvs1:/tmp/cvs-serv4619 Modified Files: PgSqlClientSetup.gi2 Log Message: Updated Installation file Index: PgSqlClientSetup.gi2 =================================================================== RCS file: /cvsroot/pgsqlclient/pgsqlclient_10/WindowsSetup/PgSqlClientSetup.gi2,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** PgSqlClientSetup.gi2 18 Sep 2003 14:22:22 -0000 1.3 --- PgSqlClientSetup.gi2 11 Oct 2003 10:12:20 -0000 1.4 *************** *** 5,11 **** <component id="Main" name="Main"> <files> ! <file src="..\build\distribution\*.*" dst="%InstallPath%\*.*" /> ! <file src="..\build\distribution\PostgreSql.Data.PgSqlClient.dll" dst="%GAC%\PostgreSql.Data.PgSqlClient.dll" /> ! <file src="..\build\distribution\System.Security.Tls.dll" dst="%GAC%\System.Security.Tls.dll" /> </files> <shortcuts> --- 5,11 ---- <component id="Main" name="Main"> <files> ! <file src="..\build\net-1.0\distribution\*.*" dst="%InstallPath%\*.*" /> ! <file src="..\build\net-1.0\distribution\PostgreSql.Data.PgSqlClient.dll" dst="%GAC%\PostgreSql.Data.PgSqlClient.dll" /> ! <file src="..\build\net-1.0\distribution\System.Security.Tls.dll" dst="%GAC%\System.Security.Tls.dll" /> </files> <shortcuts> *************** *** 15,19 **** <!--component id="Help" name="Help"> <files> ! <file src="..\build\distribution\*.chm" dst="%InstallPath%\*.*" /> </files> <shortcuts> --- 15,19 ---- <!--component id="Help" name="Help"> <files> ! <file src="..\build\net-1.0\distribution\*.chm" dst="%InstallPath%\*.*" /> </files> <shortcuts> *************** *** 23,27 **** <component id="License" name="License"> <files> ! <file src="..\build\distribution\LICENSE.TXT" dst="%InstallPath%\*.*" /> </files> <shortcuts> --- 23,27 ---- <component id="License" name="License"> <files> ! <file src="..\build\net-1.0\distribution\LICENSE.TXT" dst="%InstallPath%\*.*" /> </files> <shortcuts> *************** *** 31,35 **** <component id="Readme" name="Readme"> <files> ! <file src="..\build\distribution\README.TXT" dst="%InstallPath%\*.*" /> </files> <shortcuts> --- 31,35 ---- <component id="Readme" name="Readme"> <files> ! <file src="..\build\net-1.0\distribution\README.TXT" dst="%InstallPath%\*.*" /> </files> <shortcuts> *************** *** 39,43 **** <component id="Changes" name="Changes"> <files> ! <file src="..\build\distribution\CHANGES.TXT" dst="%InstallPath%\*.*" /> </files> <shortcuts> --- 39,43 ---- <component id="Changes" name="Changes"> <files> ! <file src="..\build\net-1.0\distribution\CHANGES.TXT" dst="%InstallPath%\*.*" /> </files> <shortcuts> *************** *** 92,97 **** <presetup> <file action="add" src="presetup\*.*"/> ! <file src="..\build\distribution\README.TXT" /> ! <file src="..\build\distribution\LICENSE.TXT" /> </presetup> </package> --- 92,97 ---- <presetup> <file action="add" src="presetup\*.*"/> ! <file src="..\build\net-1.0\distribution\README.TXT" /> ! <file src="..\build\net-1.0\distribution\LICENSE.TXT" /> </presetup> </package> *************** *** 102,106 **** <variables> <var name="AppID" value="PgSqlClient ADO.NET Data Provider 1.0" /> ! <var name="AppName" value="PgSqlClient ADO.NET Data Provider 1.0 Beta 2" /> <var name="OutputPath" value="Output" type="normal"/> <var name="Password" type="normal"/> --- 102,106 ---- <variables> <var name="AppID" value="PgSqlClient ADO.NET Data Provider 1.0" /> ! <var name="AppName" value="PgSqlClient ADO.NET Data Provider 1.0 Beta 3" /> <var name="OutputPath" value="Output" type="normal"/> <var name="Password" type="normal"/> |
From: <car...@us...> - 2003-10-11 10:10:18
|
Update of /cvsroot/pgsqlclient/pgsqlclient_10/Mono.Security.Protocol.Tls In directory sc8-pr-cvs1:/tmp/cvs-serv4302 Modified Files: README.TXT Log Message: TLS Library is relicensed under the MIT/X11 license for allow integration into mono:: project Index: README.TXT =================================================================== RCS file: /cvsroot/pgsqlclient/pgsqlclient_10/Mono.Security.Protocol.Tls/README.TXT,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** README.TXT 11 Oct 2003 10:02:46 -0000 1.1 --- README.TXT 11 Oct 2003 10:10:14 -0000 1.2 *************** *** 2,7 **** ------------------------------ ! Transport Security Layer (TLS) protocol for .NET and mono ! developend in C#. --- 2,6 ---- ------------------------------ ! Transport Security Layer (TLS) protocol implementation. |
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-serv4143 Added Files: TlsClientCertificate.cs TlsClientCertificateVerify.cs TlsClientFinished.cs TlsClientHello.cs TlsClientKeyExchange.cs TlsServerCertificate.cs TlsServerCertificateRequest.cs TlsServerFinished.cs TlsServerHello.cs TlsServerHelloDone.cs TlsServerKeyExchange.cs Log Message: TLS Library is relicensed under the MIT/X11 license for allow integration into mono:: project --- NEW FILE: TlsClientCertificate.cs --- (This appears to be a binary file; contents omitted.) --- NEW FILE: TlsClientCertificateVerify.cs --- (This appears to be a binary file; contents omitted.) --- NEW FILE: TlsClientFinished.cs --- (This appears to be a binary file; contents omitted.) --- NEW FILE: TlsClientHello.cs --- (This appears to be a binary file; contents omitted.) --- NEW FILE: TlsClientKeyExchange.cs --- (This appears to be a binary file; contents omitted.) --- NEW FILE: TlsServerCertificate.cs --- (This appears to be a binary file; contents omitted.) --- NEW FILE: TlsServerCertificateRequest.cs --- (This appears to be a binary file; contents omitted.) --- NEW FILE: TlsServerFinished.cs --- (This appears to be a binary file; contents omitted.) --- NEW FILE: TlsServerHello.cs --- (This appears to be a binary file; contents omitted.) --- NEW FILE: TlsServerHelloDone.cs --- (This appears to be a binary file; contents omitted.) --- NEW FILE: TlsServerKeyExchange.cs --- (This appears to be a binary file; contents omitted.) |
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-serv4057/Mono.Security.Protocol.Tls.Handshake.Client Log Message: Directory /cvsroot/pgsqlclient/pgsqlclient_10/Mono.Security.Protocol.Tls/Mono.Security.Protocol.Tls/Mono.Security.Protocol.Tls.Handshake/Mono.Security.Protocol.Tls.Handshake.Client added to the repository |
From: <car...@us...> - 2003-10-11 10:09:00
|
Update of /cvsroot/pgsqlclient/pgsqlclient_10/Mono.Security.Protocol.Tls/Mono.Security.Protocol.Tls/Mono.Security.Protocol.Tls.Handshake In directory sc8-pr-cvs1:/tmp/cvs-serv3936 Added Files: TlsClientCertificateType.cs TlsHandshakeHashes.cs TlsHandshakeMessage.cs TlsHandshakeType.cs Log Message: TLS Library is relicensed under the MIT/X11 license for allow integration into mono:: project --- NEW FILE: TlsClientCertificateType.cs --- (This appears to be a binary file; contents omitted.) --- NEW FILE: TlsHandshakeHashes.cs --- (This appears to be a binary file; contents omitted.) --- NEW FILE: TlsHandshakeMessage.cs --- (This appears to be a binary file; contents omitted.) --- NEW FILE: TlsHandshakeType.cs --- (This appears to be a binary file; contents omitted.) |
Update of /cvsroot/pgsqlclient/pgsqlclient_10/Mono.Security.Protocol.Tls/Mono.Security.Protocol.Tls/Mono.Security.Protocol.Tls.Alerts In directory sc8-pr-cvs1:/tmp/cvs-serv3850a Added Files: TlsAlert.cs TlsCloseNotifyAlert.cs TlsWarningAlertEventArgs.cs Log Message: TLS Library is relicensed under the MIT/X11 license for allow integration into mono:: project --- NEW FILE: TlsAlert.cs --- (This appears to be a binary file; contents omitted.) --- NEW FILE: TlsCloseNotifyAlert.cs --- (This appears to be a binary file; contents omitted.) --- NEW FILE: TlsWarningAlertEventArgs.cs --- (This appears to be a binary file; contents omitted.) |
Update of /cvsroot/pgsqlclient/pgsqlclient_10/Mono.Security.Protocol.Tls/Mono.Security.Protocol.Tls/Mono.Security/Mono.Security.Cryptography In directory sc8-pr-cvs1:/tmp/cvs-serv3721 Added Files: ARC4Managed.cs HMAC.cs RC4.cs Log Message: TLS Library is relicensed under the MIT/X11 license for allow integration into mono:: project --- NEW FILE: ARC4Managed.cs --- // // ARC4Managed.cs: Alleged RC4(tm) compatible symmetric stream cipher // RC4 is a trademark of RSA Security // using System; using System.Security.Cryptography; namespace Mono.Security.Cryptography { // References: // a. Usenet 1994 - RC4 Algorithm revealed // http://www.qrst.de/html/dsds/rc4.htm internal class ARC4Managed : RC4, ICryptoTransform { private byte[] key; private byte[] state; private byte x; private byte y; private bool m_disposed; public ARC4Managed () : base () { state = new byte [256]; m_disposed = false; } ~ARC4Managed () { Dispose (true); } protected override void Dispose (bool disposing) { if (!m_disposed) { x = 0; y = 0; if (key != null) { Array.Clear (key, 0, key.Length); key = null; } Array.Clear (state, 0, state.Length); state = null; GC.SuppressFinalize (this); m_disposed = true; } } public override byte[] Key { get { return (byte[]) key.Clone (); } set { key = (byte[]) value.Clone (); KeySetup (key); } } public bool CanReuseTransform { get { return false; } } public override ICryptoTransform CreateEncryptor (byte[] rgbKey, byte[] rgvIV) { Key = rgbKey; return (ICryptoTransform) this; } public override ICryptoTransform CreateDecryptor (byte[] rgbKey, byte[] rgvIV) { Key = rgbKey; return CreateEncryptor (); } public override void GenerateIV () { // not used for a stream cipher IV = new byte [0]; } public override void GenerateKey () { byte[] key = new byte [KeySizeValue >> 3]; RandomNumberGenerator rng = RandomNumberGenerator.Create (); rng.GetBytes (key); Key = key; } public bool CanTransformMultipleBlocks { get { return true; } } public int InputBlockSize { get { return 1; } } public int OutputBlockSize { get { return 1; } } private void KeySetup (byte[] key) { byte index1 = 0; byte index2 = 0; for (int counter = 0; counter < 256; counter++) state [counter] = (byte) counter; x = 0; y = 0; for (int counter = 0; counter < 256; counter++) { index2 = (byte) ((key [index1] + state [counter] + index2) % 256); // swap byte byte tmp = state [counter]; state [counter] = state [index2]; state [index2] = tmp; index1 = (byte) ((index1 + 1) % key.Length); } } public int TransformBlock (byte[] inputBuffer, int inputOffset, int inputCount, byte[] outputBuffer, int outputOffset) { byte xorIndex; for (int counter = 0; counter < inputCount; counter ++) { x = (byte) ((x + 1) % 256); y = (byte) ((state [x] + y) % 256); // swap byte byte tmp = state [x]; state [x] = state [y]; state [y] = tmp; xorIndex = (byte) (state [x] + (state [y]) % 256); outputBuffer [outputOffset + counter] = (byte) (inputBuffer [inputOffset + counter] ^ state [xorIndex]); } return inputCount; } public byte[] TransformFinalBlock (byte[] inputBuffer, int inputOffset, int inputCount) { byte[] output = new byte [inputCount]; TransformBlock (inputBuffer, inputOffset, inputCount, output, 0); return output; } } } --- NEW FILE: HMAC.cs --- (This appears to be a binary file; contents omitted.) --- NEW FILE: RC4.cs --- // // RC4.cs: RC4(tm) symmetric stream cipher // RC4 is a trademark of RSA Security // // Author: // Sebastien Pouliot (spo...@mo...) // // (C) 2003 Motus Technologies Inc. (http://www.motus.com) // using System; using System.Security.Cryptography; namespace Mono.Security.Cryptography { internal abstract class RC4 : SymmetricAlgorithm { private static KeySizes[] s_legalBlockSizes = { new KeySizes (64, 64, 0) }; private static KeySizes[] s_legalKeySizes = { new KeySizes (40, 2048, 8) }; public RC4() { KeySizeValue = 128; BlockSizeValue = 64; FeedbackSizeValue = BlockSizeValue; LegalBlockSizesValue = s_legalBlockSizes; LegalKeySizesValue = s_legalKeySizes; } new static public RC4 Create() { return Create ("RC4"); } new static public RC4 Create (string algName) { object o = CryptoConfig.CreateFromName (algName); // in case machine.config isn't configured to use // any RC4 implementation if (o == null) { o = new ARC4Managed (); } return (RC4) o; } } } |
From: <car...@us...> - 2003-10-11 10:06:59
|
Update of /cvsroot/pgsqlclient/pgsqlclient_10/Mono.Security.Protocol.Tls/Mono.Security.Protocol.Tls/Mono.Security/Mono.Security.Cryptography In directory sc8-pr-cvs1:/tmp/cvs-serv3614/Mono.Security.Cryptography Log Message: Directory /cvsroot/pgsqlclient/pgsqlclient_10/Mono.Security.Protocol.Tls/Mono.Security.Protocol.Tls/Mono.Security/Mono.Security.Cryptography added to the repository |
From: <car...@us...> - 2003-10-11 10:06:47
|
Update of /cvsroot/pgsqlclient/pgsqlclient_10/Mono.Security.Protocol.Tls/Mono.Security.Protocol.Tls/Mono.Security In directory sc8-pr-cvs1:/tmp/cvs-serv3586 Added Files: ASN1.cs Log Message: TLS Library is relicensed under the MIT/X11 license for allow integration into mono:: project --- NEW FILE: ASN1.cs --- // // ASN1.cs: Abstract Syntax Notation 1 - micro-parser and generator // // Author: // Sebastien Pouliot (spo...@mo...) // // (C) 2002, 2003 Motus Technologies Inc. (http://www.motus.com) // using System; using System.Collections; namespace Mono.Security { // References: // a. ITU ASN.1 standards (free download) // http://www.itu.int/ITU-T/studygroups/com17/languages/ internal class ASN1 { protected byte m_nTag; protected byte[] m_aValue; protected ArrayList elist; public ASN1 () : this (0x00, null) {} public ASN1 (byte tag) : this (tag, null) {} public ASN1 (byte tag, byte[] data) { m_nTag = tag; m_aValue = data; } public ASN1 (byte[] data) { m_nTag = data [0]; int nLenLength = 0; int nLength = data [1]; if (nLength > 0x80) { // composed length nLenLength = nLength - 0x80; nLength = 0; for (int i = 0; i < nLenLength; i++) { nLength *= 256; nLength += data [i + 2]; } } m_aValue = new byte [nLength]; Array.Copy (data, (2 + nLenLength), m_aValue, 0, nLength); if ((m_nTag & 0x20) == 0x20) { int nStart = (2 + nLenLength); Decode (data, ref nStart, data.Length); } } public int Count { get { if (elist == null) return 0; return elist.Count; } } public byte Tag { get { return m_nTag; } } public int Length { get { if (m_aValue != null) return m_aValue.Length; else return 0; } } public byte[] Value { get { if (m_aValue == null) GetBytes (); return (byte[]) m_aValue.Clone (); } set { if (value != null) m_aValue = (byte[]) value.Clone (); } } private bool CompareArray (byte[] array1, byte[] array2) { bool bResult = (array1.Length == array2.Length); if (bResult) { for (int i = 0; i < array1.Length; i++) { if (array1[i] != array2[i]) return false; } } return bResult; } public bool Equals (byte[] asn1) { return CompareArray (this.GetBytes (), asn1); } public bool CompareValue (byte[] aValue) { return CompareArray (m_aValue, aValue); } public virtual ASN1 Add (ASN1 asn1) { if (asn1 != null) { if (elist == null) elist = new ArrayList (); elist.Add (asn1); } return asn1; } public virtual byte[] GetBytes () { byte[] val = null; if (m_aValue != null) { val = m_aValue; } else if (Count > 0) { int esize = 0; ArrayList al = new ArrayList (); foreach (ASN1 a in elist) { byte[] item = a.GetBytes (); al.Add (item); esize += item.Length; } val = new byte [esize]; int pos = 0; for (int i=0; i < elist.Count; i++) { byte[] item = (byte[]) al[i]; Array.Copy (item, 0, val, pos, item.Length); pos += item.Length; } } byte[] der; int nLengthLen = 0; if (val != null) { int nLength = val.Length; // special for length > 127 if (nLength > 127) { if (nLength < 256) { der = new byte [3 + nLength]; Array.Copy (val, 0, der, 3, nLength); nLengthLen += 0x81; der[2] = (byte)(nLength); } else { der = new byte [4 + nLength]; Array.Copy (val, 0, der, 4, nLength); nLengthLen += 0x82; der[2] = (byte)(nLength / 256); der[3] = (byte)(nLength % 256); } } else { der = new byte [2 + nLength]; Array.Copy (val, 0, der, 2, nLength); nLengthLen = nLength; } if (m_aValue == null) m_aValue = val; } else der = new byte[2]; der[0] = m_nTag; der[1] = (byte)nLengthLen; return der; } // Note: Recursive protected void Decode (byte[] asn1, ref int anPos, int anLength) { byte nTag; int nLength; byte[] aValue; // minimum is 2 bytes (tag + length of 0) while (anPos < anLength - 1) { int nPosOri = anPos; DecodeTLV (asn1, ref anPos, out nTag, out nLength, out aValue); ASN1 elm = Add (new ASN1 (nTag, aValue)); if ((nTag & 0x20) == 0x20) { int nConstructedPos = anPos; elm.Decode (asn1, ref nConstructedPos, nConstructedPos + nLength); } anPos += nLength; // value length } } // TLV : Tag - Length - Value protected void DecodeTLV (byte[] asn1, ref int anPos, out byte anTag, out int anLength, out byte[] aValue) { anTag = asn1 [anPos++]; anLength = asn1 [anPos++]; // special case where L contains the Length of the Length + 0x80 if ((anLength & 0x80) == 0x80) { int nLengthLen = anLength & 0x7F; anLength = 0; for (int i = 0; i < nLengthLen; i++) anLength = anLength * 256 + asn1 [anPos++]; } aValue = new byte [anLength]; Array.Copy (asn1, anPos, aValue, 0, anLength); } public ASN1 this [int index] { get { try { if (index >= elist.Count) return null; return (ASN1) elist [index]; } catch { return null; } } } public ASN1 Element (int index, byte anTag) { try { if (index >= elist.Count) return null; ASN1 elm = (ASN1) elist [index]; if (elm.Tag == anTag) return elm; else return null; } catch { return null; } } } } |
From: <car...@us...> - 2003-10-11 10:05:11
|
Update of /cvsroot/pgsqlclient/pgsqlclient_10/Mono.Security.Protocol.Tls/Mono.Security.Protocol.Tls/Mono.Security.Protocol.Tls.Handshake In directory sc8-pr-cvs1:/tmp/cvs-serv3365/Mono.Security.Protocol.Tls.Handshake Log Message: Directory /cvsroot/pgsqlclient/pgsqlclient_10/Mono.Security.Protocol.Tls/Mono.Security.Protocol.Tls/Mono.Security.Protocol.Tls.Handshake added to the repository |
From: <car...@us...> - 2003-10-11 10:04:46
|
Update of /cvsroot/pgsqlclient/pgsqlclient_10/Mono.Security.Protocol.Tls/Mono.Security.Protocol.Tls/Mono.Security.Protocol.Tls.Alerts In directory sc8-pr-cvs1:/tmp/cvs-serv3256/Mono.Security.Protocol.Tls.Alerts Log Message: Directory /cvsroot/pgsqlclient/pgsqlclient_10/Mono.Security.Protocol.Tls/Mono.Security.Protocol.Tls/Mono.Security.Protocol.Tls.Alerts added to the repository |
From: <car...@us...> - 2003-10-11 10:04:37
|
Update of /cvsroot/pgsqlclient/pgsqlclient_10/Mono.Security.Protocol.Tls/Mono.Security.Protocol.Tls/Mono.Security In directory sc8-pr-cvs1:/tmp/cvs-serv3225/Mono.Security Log Message: Directory /cvsroot/pgsqlclient/pgsqlclient_10/Mono.Security.Protocol.Tls/Mono.Security.Protocol.Tls/Mono.Security added to the repository |
Update of /cvsroot/pgsqlclient/pgsqlclient_10/Mono.Security.Protocol.Tls/Mono.Security.Protocol.Tls In directory sc8-pr-cvs1:/tmp/cvs-serv3181 Added Files: AssemblyInfo.cs TlsCipherSuite.cs TlsCipherSuiteCollection.cs TlsContentType.cs TlsException.cs TlsNetworkStream.cs TlsProtocol.cs TlsServerSettings.cs TlsSession.cs TlsSessionContext.cs TlsSessionSettings.cs TlsSessionState.cs TlsSocket.cs TlsStreamReader.cs TlsStreamWriter.cs Log Message: TLS Library is relicensed under the MIT/X11 license for allow integration into mono:: project --- NEW FILE: AssemblyInfo.cs --- (This appears to be a binary file; contents omitted.) --- NEW FILE: TlsCipherSuite.cs --- (This appears to be a binary file; contents omitted.) --- NEW FILE: TlsCipherSuiteCollection.cs --- (This appears to be a binary file; contents omitted.) --- NEW FILE: TlsContentType.cs --- (This appears to be a binary file; contents omitted.) --- NEW FILE: TlsException.cs --- (This appears to be a binary file; contents omitted.) --- NEW FILE: TlsNetworkStream.cs --- (This appears to be a binary file; contents omitted.) --- NEW FILE: TlsProtocol.cs --- (This appears to be a binary file; contents omitted.) --- NEW FILE: TlsServerSettings.cs --- (This appears to be a binary file; contents omitted.) --- NEW FILE: TlsSession.cs --- (This appears to be a binary file; contents omitted.) --- NEW FILE: TlsSessionContext.cs --- (This appears to be a binary file; contents omitted.) --- NEW FILE: TlsSessionSettings.cs --- (This appears to be a binary file; contents omitted.) --- NEW FILE: TlsSessionState.cs --- (This appears to be a binary file; contents omitted.) --- NEW FILE: TlsSocket.cs --- (This appears to be a binary file; contents omitted.) --- NEW FILE: TlsStreamReader.cs --- (This appears to be a binary file; contents omitted.) --- NEW FILE: TlsStreamWriter.cs --- (This appears to be a binary file; contents omitted.) |
From: <car...@us...> - 2003-10-11 10:03:02
|
Update of /cvsroot/pgsqlclient/pgsqlclient_10/Mono.Security.Protocol.Tls/Mono.Security.Protocol.Tls In directory sc8-pr-cvs1:/tmp/cvs-serv2949/Mono.Security.Protocol.Tls Log Message: Directory /cvsroot/pgsqlclient/pgsqlclient_10/Mono.Security.Protocol.Tls/Mono.Security.Protocol.Tls added to the repository |