pgsqlclient-checkins Mailing List for PostgreSqlClient (Page 23)
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...> - 2004-02-19 14:05:00
|
Update of /cvsroot/pgsqlclient/pgsqlclient_10/Mono.Security In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv30119 Modified Files: changelog.txt Log Message: 2004-02-19 Carlos Guzmán Álvarez <car...@te...> * Mono.Security.Protocol.Tls/RecordProtocol.cs: * Mono.Security.Protocol.Tls/ClientRecordProtocol.cs: - New classes for handle the SSL/TLS record protocol. * Mono.Security.Protocol.Tls/SslClientStream.cs: - Record protocol stuff moved to the new classes. - Removed Warning event. Index: changelog.txt =================================================================== RCS file: /cvsroot/pgsqlclient/pgsqlclient_10/Mono.Security/changelog.txt,v retrieving revision 1.7 retrieving revision 1.8 diff -C2 -d -r1.7 -r1.8 *** changelog.txt 18 Feb 2004 15:42:14 -0000 1.7 --- changelog.txt 19 Feb 2004 13:54:32 -0000 1.8 *************** *** 3,6 **** --- 3,19 ---- + 2004-02-19 Carlos Guzmán Álvarez <car...@te...> + + * Mono.Security.Protocol.Tls/RecordProtocol.cs: + * Mono.Security.Protocol.Tls/ClientRecordProtocol.cs: + + - New classes for handle the SSL/TLS record protocol. + + * Mono.Security.Protocol.Tls/SslClientStream.cs: + + - Record protocol stuff moved to the new classes. + + - Removed Warning event. + 2004-02-18 Carlos Guzmán Álvarez <car...@te...> |
Update of /cvsroot/pgsqlclient/pgsqlclient_10/Mono.Security/Mono.Security/Mono.Security.Protocol.Tls In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv29951 Modified Files: SslClientStream.cs Added Files: ClientRecordProtocol.cs RecordProtocol.cs Log Message: 2004-02-19 Carlos Guzmán Álvarez <car...@te...> * Mono.Security.Protocol.Tls/RecordProtocol.cs: * Mono.Security.Protocol.Tls/ClientRecordProtocol.cs: - New classes for handle the SSL/TLS record protocol. * Mono.Security.Protocol.Tls/SslClientStream.cs: - Record protocol stuff moved to the new classes. - Removed Warning event. --- NEW FILE: ClientRecordProtocol.cs --- /* Transport Security Layer (TLS) * Copyright (c) 2003-2004 Carlos Guzman Alvarez * * Permission is hereby granted, free of charge, to any person * obtaining a copy of this software and associated documentation * files (the "Software"), to deal in the Software without restriction, * including without limitation the rights to use, copy, modify, merge, * publish, distribute, sublicense, and/or sell copies of the Software, * and to permit persons to whom the Software is furnished to do so, * subject to the following conditions: * * The above copyright notice and this permission notice shall be included * in all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT * HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER * DEALINGS IN THE SOFTWARE. */ using System; using System.IO; using Mono.Security.Protocol.Tls.Alerts; using Mono.Security.Protocol.Tls.Handshake; using Mono.Security.Protocol.Tls.Handshake.Client; namespace Mono.Security.Protocol.Tls { internal class ClientRecordProtocol : RecordProtocol { #region Constructors public ClientRecordProtocol( Stream innerStream, TlsContext context) : base(innerStream, context) { } #endregion #region Send Messages public override void SendRecord(TlsHandshakeType type) { // Create the record message TlsHandshakeMessage msg = this.createClientHandshakeMessage(type); // Write record this.SendRecord(msg.ContentType, msg.EncodeMessage()); // Update session msg.Update(); // Reset message contents msg.Reset(); } #endregion #region Handshake Processing Methods protected override void ProcessHandshakeMessage(TlsStream 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 = this.createServerHandshakeMessage(handshakeType, data); // Update session if (message != null) { message.Update(); } } #endregion #region Client Handshake Message Factories private TlsHandshakeMessage createClientHandshakeMessage(TlsHandshakeType type) { switch (type) { case TlsHandshakeType.ClientHello: return new TlsClientHello(this.context); case TlsHandshakeType.Certificate: return new TlsClientCertificate(this.context); case TlsHandshakeType.ClientKeyExchange: return new TlsClientKeyExchange(this.context); case TlsHandshakeType.CertificateVerify: return new TlsClientCertificateVerify(this.context); case TlsHandshakeType.Finished: return new TlsClientFinished(this.context); default: throw new InvalidOperationException("Unknown client handshake message type: " + type.ToString() ); } } private TlsHandshakeMessage createServerHandshakeMessage(TlsHandshakeType type, byte[] buffer) { switch (type) { case TlsHandshakeType.HelloRequest: this.SendRecord(TlsHandshakeType.ClientHello); return null; case TlsHandshakeType.ServerHello: return new TlsServerHello(this.context, buffer); case TlsHandshakeType.Certificate: return new TlsServerCertificate(this.context, buffer); case TlsHandshakeType.ServerKeyExchange: return new TlsServerKeyExchange(this.context, buffer); case TlsHandshakeType.CertificateRequest: return new TlsServerCertificateRequest(this.context, buffer); case TlsHandshakeType.ServerHelloDone: return new TlsServerHelloDone(this.context, buffer); case TlsHandshakeType.Finished: return new TlsServerFinished(this.context, buffer); default: throw this.context.CreateException("Unknown server handshake message received ({0})", type.ToString()); } } #endregion } } --- NEW FILE: RecordProtocol.cs --- /* Transport Security Layer (TLS) * Copyright (c) 2003-2004 Carlos Guzman Alvarez * * Permission is hereby granted, free of charge, to any person * obtaining a copy of this software and associated documentation * files (the "Software"), to deal in the Software without restriction, * including without limitation the rights to use, copy, modify, merge, * publish, distribute, sublicense, and/or sell copies of the Software, * and to permit persons to whom the Software is furnished to do so, * subject to the following conditions: * * The above copyright notice and this permission notice shall be included * in all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT * HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER * DEALINGS IN THE SOFTWARE. */ using System; using System.IO; using System.Security.Cryptography; using System.Security.Cryptography.X509Certificates; using Mono.Security.Protocol.Tls.Alerts; using Mono.Security.Protocol.Tls.Handshake; namespace Mono.Security.Protocol.Tls { internal abstract class RecordProtocol { #region Fields protected Stream innerStream; protected TlsContext context; #endregion #region Properties public Stream InnerStream { get { return this.innerStream; } set { this.innerStream = value; } } public TlsContext Context { get { return this.context; } set { this.context = value; } } #endregion #region Constructors public RecordProtocol(Stream innerStream, TlsContext context) { this.innerStream = innerStream; this.context = context; } #endregion #region Abstract Methods public abstract void SendRecord(TlsHandshakeType type); protected abstract void ProcessHandshakeMessage(TlsStream handMsg); #endregion #region Reveive Record Methods public byte[] ReceiveRecord() { if (this.context.ConnectionEnd) { throw this.context.CreateException("The session is finished and it's no longer valid."); } // Try to read the Record Content Type int type = this.innerStream.ReadByte(); // There are no more data for read if (type == -1) { return null; } TlsContentType contentType = (TlsContentType)type; short protocol = this.readShort(); short length = this.readShort(); // Read Record data int received = 0; byte[] buffer = new byte[length]; while (received != length) { received += this.innerStream.Read( buffer, received, buffer.Length - received); } TlsStream message = new TlsStream(buffer); // Check that the message has a valid protocol version if (protocol != this.context.Protocol) { throw this.context.CreateException("Invalid protocol version on message received from server"); } // Decrypt message contents if needed if (contentType == TlsContentType.Alert && length == 2) { } else { if (this.context.IsActual && contentType != TlsContentType.ChangeCipherSpec) { message = this.decryptRecordFragment( contentType, message.ToArray()); } } byte[] result = message.ToArray(); // Process record switch (contentType) { case TlsContentType.Alert: this.processAlert( (TlsAlertLevel)message.ReadByte(), (TlsAlertDescription)message.ReadByte()); break; case TlsContentType.ChangeCipherSpec: // Reset sequence numbers this.context.ReadSequenceNumber = 0; break; case TlsContentType.ApplicationData: break; case TlsContentType.Handshake: while (!message.EOF) { this.ProcessHandshakeMessage(message); } // Update handshakes of current messages this.context.HandshakeMessages.Write(message.ToArray()); break; default: throw this.context.CreateException("Unknown record received from server."); } return result; } private short readShort() { byte[] b = new byte[2]; this.innerStream.Read(b, 0, b.Length); short val = BitConverter.ToInt16(b, 0); return System.Net.IPAddress.HostToNetworkOrder(val); } private void processAlert( TlsAlertLevel alertLevel, TlsAlertDescription alertDesc) { switch (alertLevel) { case TlsAlertLevel.Fatal: throw this.context.CreateException(alertLevel, alertDesc); case TlsAlertLevel.Warning: default: switch (alertDesc) { case TlsAlertDescription.CloseNotify: this.context.ConnectionEnd = true; break; } break; } } #endregion #region Send Record Methods public void SendAlert(TlsAlert alert) { // Write record this.SendRecord(TlsContentType.Alert, alert.ToArray()); // Update session alert.Update(); // Reset message contents alert.Reset(); } public void SendChangeCipherSpec() { // Send Change Cipher Spec message this.SendRecord(TlsContentType.ChangeCipherSpec, new byte[] {1}); // Reset sequence numbers this.context.WriteSequenceNumber = 0; // Make the pending state to be the current state this.context.IsActual = true; // Send Finished message this.SendRecord(TlsHandshakeType.Finished); } public void SendRecord(TlsContentType contentType, byte[] recordData) { if (this.context.ConnectionEnd) { throw this.context.CreateException("The session is finished and it's no longer valid."); } byte[] record = this.EncodeRecord(contentType, recordData); this.innerStream.Write(record, 0, record.Length); } public byte[] EncodeRecord(TlsContentType contentType, byte[] recordData) { return this.EncodeRecord( contentType, recordData, 0, recordData.Length); } public byte[] EncodeRecord( TlsContentType contentType, byte[] recordData, int offset, int count) { if (this.context.ConnectionEnd) { throw this.context.CreateException("The session is finished and it's no longer valid."); } TlsStream record = new TlsStream(); int position = offset; while (position < ( offset + count )) { short fragmentLength = 0; byte[] fragment; if ((count - position) > TlsContext.MAX_FRAGMENT_SIZE) { fragmentLength = TlsContext.MAX_FRAGMENT_SIZE; } else { fragmentLength = (short)(count - position); } // Fill the fragment data fragment = new byte[fragmentLength]; Buffer.BlockCopy(recordData, position, fragment, 0, fragmentLength); if (this.context.IsActual) { // Encrypt fragment fragment = this.encryptRecordFragment(contentType, fragment); } // Write tls message record.Write((byte)contentType); record.Write(this.context.Protocol); record.Write((short)fragment.Length); record.Write(fragment); // Update buffer position position += fragmentLength; } return record.ToArray(); } #endregion #region Cryptography Methods private byte[] encryptRecordFragment( TlsContentType contentType, byte[] fragment) { // Calculate message MAC byte[] mac = this.context.Cipher.ComputeClientRecordMAC(contentType, fragment); // Encrypt the message byte[] ecr = this.context.Cipher.EncryptRecord(fragment, mac); // Set new IV if (this.context.Cipher.CipherMode == CipherMode.CBC) { byte[] iv = new byte[this.context.Cipher.IvSize]; System.Array.Copy(ecr, ecr.Length - iv.Length, iv, 0, iv.Length); this.context.Cipher.UpdateClientCipherIV(iv); } // Update sequence number this.context.WriteSequenceNumber++; return ecr; } private TlsStream decryptRecordFragment( TlsContentType contentType, byte[] fragment) { byte[] dcrFragment = null; byte[] dcrMAC = null; // Decrypt message this.context.Cipher.DecryptRecord(fragment, ref dcrFragment, ref dcrMAC); // Set new IV if (this.context.Cipher.CipherMode == CipherMode.CBC) { byte[] iv = new byte[this.context.Cipher.IvSize]; System.Array.Copy(fragment, fragment.Length - iv.Length, iv, 0, iv.Length); this.context.Cipher.UpdateServerCipherIV(iv); } // Check MAC code byte[] mac = this.context.Cipher.ComputeServerRecordMAC(contentType, dcrFragment); // Check that the mac is correct if (mac.Length != dcrMAC.Length) { throw new TlsException("Invalid MAC received from server."); } for (int i = 0; i < mac.Length; i++) { if (mac[i] != dcrMAC[i]) { throw new TlsException("Invalid MAC received from server."); } } // Update sequence number this.context.ReadSequenceNumber++; return new TlsStream(dcrFragment); } #endregion } } Index: SslClientStream.cs =================================================================== RCS file: /cvsroot/pgsqlclient/pgsqlclient_10/Mono.Security/Mono.Security/Mono.Security.Protocol.Tls/SslClientStream.cs,v retrieving revision 1.8 retrieving revision 1.9 diff -C2 -d -r1.8 -r1.9 *** SslClientStream.cs 18 Feb 2004 15:28:13 -0000 1.8 --- SslClientStream.cs 19 Feb 2004 13:54:09 -0000 1.9 *************** *** 34,38 **** using Mono.Security.Protocol.Tls.Alerts; using Mono.Security.Protocol.Tls.Handshake; - using Mono.Security.Protocol.Tls.Handshake.Client; namespace Mono.Security.Protocol.Tls --- 34,37 ---- *************** *** 58,67 **** public class SslClientStream : Stream, IDisposable { - #region Events - - public event TlsWarningAlertEventHandler WarningAlert; - - #endregion - #region Internal Events --- 57,60 ---- *************** *** 80,85 **** --- 73,80 ---- private BufferedStream inputBuffer; private TlsContext context; + private ClientRecordProtocol protocol; private bool ownsStream; private bool disposed; + private bool checkCertRevocationStatus; private string read; private string write; *************** *** 121,126 **** public bool CheckCertRevocationStatus { ! get { throw new NotImplementedException(); } ! set { throw new NotImplementedException(); } } --- 116,121 ---- public bool CheckCertRevocationStatus { ! get { return this.checkCertRevocationStatus ; } ! set { this.checkCertRevocationStatus = value; } } *************** *** 346,350 **** } ! this.context = new TlsContext( this, securityProtocolType, --- 341,345 ---- } ! this.context = new TlsContext( this, securityProtocolType, *************** *** 356,359 **** --- 351,355 ---- this.read = String.Empty; this.write = String.Empty; + this.protocol = new ClientRecordProtocol(innerStream, context); } *************** *** 389,393 **** // Write close notify TlsCloseNotifyAlert alert = new TlsCloseNotifyAlert(this.context); ! this.SendAlert(alert); } --- 385,389 ---- // Write close notify TlsCloseNotifyAlert alert = new TlsCloseNotifyAlert(this.context); ! this.protocol.SendAlert(alert); } *************** *** 479,483 **** // Read next record and write it into the inputBuffer long position = this.inputBuffer.Position; ! byte[] record = this.receiveRecord(); if (record != null && record.Length > 0) --- 475,479 ---- // Read next record and write it into the inputBuffer long position = this.inputBuffer.Position; ! byte[] record = this.protocol.ReceiveRecord(); if (record != null && record.Length > 0) *************** *** 576,580 **** // Send the buffer as a TLS record ! byte[] record = this.encodeRecord( TlsContentType.ApplicationData, buffer, offset, count); --- 572,576 ---- // Send the buffer as a TLS record ! byte[] record = this.protocol.EncodeRecord( TlsContentType.ApplicationData, buffer, offset, count); *************** *** 670,1000 **** #endregion - #region Reveive Record Methods - - private byte[] receiveRecord() - { - if (this.context.ConnectionEnd) - { - throw this.context.CreateException("The session is finished and it's no longer valid."); - } - - // Try to read the Record Content Type - int type = this.innerStream.ReadByte(); - - // There are no more data for read - if (type == -1) - { - return null; - } - - TlsContentType contentType = (TlsContentType)type; - short protocol = this.ReadShort(); - short length = this.ReadShort(); - - // Read Record data - int received = 0; - byte[] buffer = new byte[length]; - while (received != length) - { - received += this.innerStream.Read( - buffer, received, buffer.Length - received); - } - - TlsStream message = new TlsStream(buffer); - - // Check that the message has a valid protocol version - if (protocol != this.context.Protocol) - { - throw this.context.CreateException("Invalid protocol version on message received from server"); - } - - // Decrypt message contents if needed - if (contentType == TlsContentType.Alert && length == 2) - { - } - else - { - if (this.context.IsActual && - contentType != TlsContentType.ChangeCipherSpec) - { - message = this.decryptRecordFragment( - contentType, - message.ToArray()); - } - } - - byte[] result = message.ToArray(); - - // Process record - switch (contentType) - { - case TlsContentType.Alert: - this.processAlert((TlsAlertLevel)message.ReadByte(), - (TlsAlertDescription)message.ReadByte()); - break; - - case TlsContentType.ChangeCipherSpec: - // Reset sequence numbers - this.context.ReadSequenceNumber = 0; - break; - - case TlsContentType.ApplicationData: - break; - - case TlsContentType.Handshake: - while (!message.EOF) - { - this.processHandshakeMessage(message); - } - // Update handshakes of current messages - this.context.HandshakeMessages.Write(message.ToArray()); - break; - - default: - throw this.context.CreateException("Unknown record received from server."); - } - - return result; - } - - #endregion - - #region Send Record Methods - - internal void SendAlert(TlsAlert alert) - { - // Write record - this.sendRecord(TlsContentType.Alert, alert.ToArray()); - - // Update session - alert.Update(); - - // Reset message contents - alert.Reset(); - } - - private void sendChangeCipherSpec() - { - // Send Change Cipher Spec message - this.sendRecord(TlsContentType.ChangeCipherSpec, new byte[] {1}); - - // Reset sequence numbers - this.context.WriteSequenceNumber = 0; - - // Make the pending state to be the current state - this.context.IsActual = true; - - // Send Finished message - this.sendRecord(TlsHandshakeType.Finished); - } - - private void sendRecord(TlsHandshakeType type) - { - TlsHandshakeMessage msg = this.createClientHandshakeMessage(type); - - // Write record - this.sendRecord(msg.ContentType, msg.EncodeMessage()); - - // Update session - msg.Update(); - - // Reset message contents - msg.Reset(); - } - - private void sendRecord(TlsContentType contentType, byte[] recordData) - { - if (this.context.ConnectionEnd) - { - throw this.context.CreateException("The session is finished and it's no longer valid."); - } - - byte[] record = this.encodeRecord(contentType, recordData); - - this.innerStream.Write(record, 0, record.Length); - } - - private byte[] encodeRecord(TlsContentType contentType, byte[] recordData) - { - return this.encodeRecord( - contentType, - recordData, - 0, - recordData.Length); - } - - private byte[] encodeRecord( - TlsContentType contentType, - byte[] recordData, - int offset, - int count) - { - if (this.context.ConnectionEnd) - { - throw this.context.CreateException("The session is finished and it's no longer valid."); - } - - TlsStream record = new TlsStream(); - - int position = offset; - - while (position < ( offset + count )) - { - short fragmentLength = 0; - byte[] fragment; - - if ((count - position) > TlsContext.MAX_FRAGMENT_SIZE) - { - fragmentLength = TlsContext.MAX_FRAGMENT_SIZE; - } - else - { - fragmentLength = (short)(count - position); - } - - // Fill the fragment data - fragment = new byte[fragmentLength]; - Buffer.BlockCopy(recordData, position, fragment, 0, fragmentLength); - - if (this.context.IsActual) - { - // Encrypt fragment - fragment = this.encryptRecordFragment(contentType, fragment); - } - - // Write tls message - record.Write((byte)contentType); - record.Write(this.context.Protocol); - record.Write((short)fragment.Length); - record.Write(fragment); - - // Update buffer position - position += fragmentLength; - } - - return record.ToArray(); - } - - #endregion - - #region Cryptography Methods - - private byte[] encryptRecordFragment( - TlsContentType contentType, - byte[] fragment) - { - // Calculate message MAC - byte[] mac = this.context.Cipher.ComputeClientRecordMAC(contentType, fragment); - - // Encrypt the message - byte[] ecr = this.context.Cipher.EncryptRecord(fragment, mac); - - // Set new IV - if (this.context.Cipher.CipherMode == CipherMode.CBC) - { - byte[] iv = new byte[this.context.Cipher.IvSize]; - System.Array.Copy(ecr, ecr.Length - iv.Length, iv, 0, iv.Length); - this.context.Cipher.UpdateClientCipherIV(iv); - } - - // Update sequence number - this.context.WriteSequenceNumber++; - - return ecr; - } - - private TlsStream decryptRecordFragment( - TlsContentType contentType, - byte[] fragment) - { - byte[] dcrFragment = null; - byte[] dcrMAC = null; - - // Decrypt message - this.context.Cipher.DecryptRecord(fragment, ref dcrFragment, ref dcrMAC); - - // Set new IV - if (this.context.Cipher.CipherMode == CipherMode.CBC) - { - byte[] iv = new byte[this.context.Cipher.IvSize]; - System.Array.Copy(fragment, fragment.Length - iv.Length, iv, 0, iv.Length); - this.context.Cipher.UpdateServerCipherIV(iv); - } - - // Check MAC code - byte[] mac = this.context.Cipher.ComputeServerRecordMAC(contentType, dcrFragment); - - // Check that the mac is correct - if (mac.Length != dcrMAC.Length) - { - throw new TlsException("Invalid MAC received from server."); - } - for (int i = 0; i < mac.Length; i++) - { - if (mac[i] != dcrMAC[i]) - { - throw new TlsException("Invalid MAC received from server."); - } - } - - // Update sequence number - this.context.ReadSequenceNumber++; - - return new TlsStream(dcrFragment); - } - - #endregion - - #region Handshake Processing Methods - - private void processHandshakeMessage(TlsStream 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 = this.createServerHandshakeMessage(handshakeType, data); - - // Update session - if (message != null) - { - message.Update(); - } - } - - private void processAlert( - TlsAlertLevel alertLevel, - TlsAlertDescription alertDesc) - { - switch (alertLevel) - { - case TlsAlertLevel.Fatal: - throw this.context.CreateException(alertLevel, alertDesc); - - case TlsAlertLevel.Warning: - default: - switch (alertDesc) - { - case TlsAlertDescription.CloseNotify: - this.context.ConnectionEnd = true; - break; - - default: - this.RaiseWarningAlert(alertLevel, alertDesc); - break; - } - break; - } - } - - #endregion - #region Misc Methods --- 666,669 ---- *************** *** 1005,1018 **** } - private short ReadShort() - { - byte[] b = new byte[2]; - this.innerStream.Read(b, 0, b.Length); - - short val = BitConverter.ToInt16(b, 0); - - return System.Net.IPAddress.HostToNetworkOrder(val); - } - private void checkDisposed() { --- 674,677 ---- *************** *** 1050,1058 **** private void doHandshake() { ! // Obtain supported cipher suite collection ! this.context.SupportedCiphers = TlsCipherSuiteFactory.GetSupportedCiphers(context.SecurityProtocol); // Send client hello ! this.sendRecord(TlsHandshakeType.ClientHello); // Read server response --- 709,717 ---- private void doHandshake() { ! // Obtain supported cipher suites ! this.context.SupportedCiphers = TlsCipherSuiteFactory.GetSupportedCiphers(this.context.SecurityProtocol); // Send client hello ! this.protocol.SendRecord(TlsHandshakeType.ClientHello); // Read server response *************** *** 1060,1064 **** { // Read next record ! this.receiveRecord(); } --- 719,723 ---- { // Read next record ! this.protocol.ReceiveRecord(); } *************** *** 1066,1074 **** if (this.context.ServerSettings.CertificateRequest) { ! this.sendRecord(TlsHandshakeType.Certificate); } // Send Client Key Exchange ! this.sendRecord(TlsHandshakeType.ClientKeyExchange); // Now initialize session cipher with the generated keys --- 725,733 ---- if (this.context.ServerSettings.CertificateRequest) { ! this.protocol.SendRecord(TlsHandshakeType.Certificate); } // Send Client Key Exchange ! this.protocol.SendRecord(TlsHandshakeType.ClientKeyExchange); // Now initialize session cipher with the generated keys *************** *** 1078,1086 **** if (this.context.ServerSettings.CertificateRequest) { ! this.sendRecord(TlsHandshakeType.CertificateVerify); } // Send Cipher Spec protocol ! this.sendChangeCipherSpec(); // Read record until server finished is received --- 737,745 ---- if (this.context.ServerSettings.CertificateRequest) { ! this.protocol.SendRecord(TlsHandshakeType.CertificateVerify); } // Send Cipher Spec protocol ! this.protocol.SendChangeCipherSpec(); // Read record until server finished is received *************** *** 1090,1094 **** // Change Cipher Spec // Server finished ! this.receiveRecord(); } --- 749,753 ---- // Change Cipher Spec // Server finished ! this.protocol.ReceiveRecord(); } *************** *** 1096,1154 **** this.context.ClearKeyInfo(); } - - private TlsHandshakeMessage createClientHandshakeMessage(TlsHandshakeType type) - { - switch (type) - { - case TlsHandshakeType.ClientHello: - return new TlsClientHello(this.context); - - case TlsHandshakeType.Certificate: - return new TlsClientCertificate(this.context); - - case TlsHandshakeType.ClientKeyExchange: - return new TlsClientKeyExchange(this.context); - - case TlsHandshakeType.CertificateVerify: - return new TlsClientCertificateVerify(this.context); - - case TlsHandshakeType.Finished: - return new TlsClientFinished(this.context); - - default: - throw new InvalidOperationException("Unknown client handshake message type: " + type.ToString() ); - } - } - - private TlsHandshakeMessage createServerHandshakeMessage(TlsHandshakeType type, byte[] buffer) - { - switch (type) - { - case TlsHandshakeType.HelloRequest: - this.sendRecord(TlsHandshakeType.ClientHello); - return null; - - case TlsHandshakeType.ServerHello: - return new TlsServerHello(this.context, buffer); - - case TlsHandshakeType.Certificate: - return new TlsServerCertificate(this.context, buffer); - - case TlsHandshakeType.ServerKeyExchange: - return new TlsServerKeyExchange(this.context, buffer); - - case TlsHandshakeType.CertificateRequest: - return new TlsServerCertificateRequest(this.context, buffer); - - case TlsHandshakeType.ServerHelloDone: - return new TlsServerHelloDone(this.context, buffer); - - case TlsHandshakeType.Finished: - return new TlsServerFinished(this.context, buffer); - - default: - throw this.context.CreateException("Unknown server handshake message received ({0})", type.ToString()); - } - } #endregion --- 755,758 ---- *************** *** 1156,1169 **** #region Event Methods - internal void RaiseWarningAlert( - TlsAlertLevel level, - TlsAlertDescription description) - { - if (WarningAlert != null) - { - WarningAlert(this, new TlsWarningAlertEventArgs(level, description)); - } - } - internal bool RaiseServerCertificateValidation( X509Certificate certificate, --- 760,763 ---- *************** *** 1212,1214 **** #endregion } ! } --- 806,808 ---- #endregion } ! } \ No newline at end of file |
From: <car...@us...> - 2004-02-18 17:02:34
|
Update of /cvsroot/pgsqlclient/pgsqlclient_10/Mono.Security/Mono.Security/Mono.Security.Protocol.Tls.Handshake.Client In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv14853 Modified Files: TlsServerCertificate.cs Log Message: no message Index: TlsServerCertificate.cs =================================================================== RCS file: /cvsroot/pgsqlclient/pgsqlclient_10/Mono.Security/Mono.Security/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 14 Feb 2004 23:52:54 -0000 1.2 --- TlsServerCertificate.cs 18 Feb 2004 16:52:47 -0000 1.3 *************** *** 142,146 **** if (!this.Context.SslStream.RaiseServerCertificateValidation( new X509Cert.X509Certificate(certificate.RawData), ! new int[]{})) { throw this.Context.CreateException("Invalid certificate received form server."); --- 142,146 ---- if (!this.Context.SslStream.RaiseServerCertificateValidation( new X509Cert.X509Certificate(certificate.RawData), ! certificateErrors)) { throw this.Context.CreateException("Invalid certificate received form server."); *************** *** 152,167 **** { string domainName = String.Empty; ! Regex search = new Regex(@"([\w\s\d]*)\s*=\s*([^,]*)"); MatchCollection elements = search.Matches(subjectName); ! foreach (Match element in elements) { ! switch (element.Groups[1].Value.Trim().ToUpper()) ! { ! case "CN": ! domainName = element.Groups[2].Value; ! break; ! } } --- 152,163 ---- { string domainName = String.Empty; ! // Regex search = new Regex(@"([\w\s\d]*)\s*=\s*([^,]*)"); ! Regex search = new Regex(@"CN=\s*([^,]*)"); MatchCollection elements = search.Matches(subjectName); ! if (elements[0].Value.StartsWith("CN=")) { ! domainName = elements[0].Value.Remove(0, 3); } |
From: <car...@us...> - 2004-02-18 15:52:36
|
Update of /cvsroot/pgsqlclient/pgsqlclient_10 In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv32607 Modified Files: changelog.txt Log Message: 2004-02-18 Carlos Guzmán Álvarez <car...@te...> * Mono.Security.Protocol.Tls/CipherAlgorithmType.cs: * Mono.Security.Protocol.Tls/HashAlgorithmType.cs: * Mono.Security.Protocol.Tls/ExchangeAlgorithmType.cs: - Added Serializable attribute. Index: changelog.txt =================================================================== RCS file: /cvsroot/pgsqlclient/pgsqlclient_10/changelog.txt,v retrieving revision 1.91 retrieving revision 1.92 diff -C2 -d -r1.91 -r1.92 *** changelog.txt 17 Feb 2004 22:06:23 -0000 1.91 --- changelog.txt 18 Feb 2004 15:42:51 -0000 1.92 *************** *** 2,5 **** --- 2,32 ---- ------------------------------------------------------- + 2004-02-18 Carlos Guzmán Álvarez <car...@te...> + + * Mono.Security.Protocol.Tls/CipherAlgorithmType.cs: + * Mono.Security.Protocol.Tls/HashAlgorithmType.cs: + * Mono.Security.Protocol.Tls/ExchangeAlgorithmType.cs: + + - Added Serializable attribute. + + * Mono.Security.Protocol.Tls/CipherSuite.cs: + * Mono.Security.Protocol.Tls/TlsCipherSuite.cs: + * Mono.Security.Protocol.Tls/TlsSslCipherSuite.cs: + * Mono.Security.Protocol.Tls/TlsContext.cs: + + - Added some optimizations proposed by Sebastien Pouliot. + + * Mono.Security.Protocol.Tls.Handshake.Client/TlsServerCertificate.cs: + + - Changes on Common Name detection and certificate error handling ( Thanks to Sebastien Pouliot for his feedback ). + + * Mono.Security.Protocol.Tls/SecurityProtocolType.cs: + + - Added Serializable attribute ( Thanks to Sebastien Pouliot for his feedback ). + + * Mono.Security.Protocol.Tls/SslClientStream.cs: + + - Fix for ServerCertificate property + 2004-02-17 Carlos Guzmán Álvarez <car...@te...> |
From: <car...@us...> - 2004-02-18 15:51:59
|
Update of /cvsroot/pgsqlclient/pgsqlclient_10/Mono.Security In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv32514 Modified Files: changelog.txt Log Message: 2004-02-18 Carlos Guzmán Álvarez <car...@te...> * Mono.Security.Protocol.Tls/CipherAlgorithmType.cs: * Mono.Security.Protocol.Tls/HashAlgorithmType.cs: * Mono.Security.Protocol.Tls/ExchangeAlgorithmType.cs: - Added Serializable attribute. Index: changelog.txt =================================================================== RCS file: /cvsroot/pgsqlclient/pgsqlclient_10/Mono.Security/changelog.txt,v retrieving revision 1.6 retrieving revision 1.7 diff -C2 -d -r1.6 -r1.7 *** changelog.txt 18 Feb 2004 15:32:17 -0000 1.6 --- changelog.txt 18 Feb 2004 15:42:14 -0000 1.7 *************** *** 5,8 **** --- 5,14 ---- 2004-02-18 Carlos Guzmán Álvarez <car...@te...> + * Mono.Security.Protocol.Tls/CipherAlgorithmType.cs: + * Mono.Security.Protocol.Tls/HashAlgorithmType.cs: + * Mono.Security.Protocol.Tls/ExchangeAlgorithmType.cs: + + - Added Serializable attribute. + * Mono.Security.Protocol.Tls/CipherSuite.cs: * Mono.Security.Protocol.Tls/TlsCipherSuite.cs: |
Update of /cvsroot/pgsqlclient/pgsqlclient_10/Mono.Security/Mono.Security/Mono.Security.Protocol.Tls In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv32330 Modified Files: CipherAlgorithmType.cs ExchangeAlgorithmType.cs HashAlgorithmType.cs Log Message: 2004-02-18 Carlos Guzmán Álvarez <car...@te...> * Mono.Security.Protocol.Tls/CipherAlgorithmType.cs: * Mono.Security.Protocol.Tls/HashAlgorithmType.cs: * Mono.Security.Protocol.Tls/ExchangeAlgorithmType.cs: - Added Serializable attribute. Index: CipherAlgorithmType.cs =================================================================== RCS file: /cvsroot/pgsqlclient/pgsqlclient_10/Mono.Security/Mono.Security/Mono.Security.Protocol.Tls/CipherAlgorithmType.cs,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** CipherAlgorithmType.cs 10 Feb 2004 09:43:42 -0000 1.1 --- CipherAlgorithmType.cs 18 Feb 2004 15:41:41 -0000 1.2 *************** *** 27,30 **** --- 27,31 ---- namespace Mono.Security.Protocol.Tls { + [Serializable] public enum CipherAlgorithmType { Index: ExchangeAlgorithmType.cs =================================================================== RCS file: /cvsroot/pgsqlclient/pgsqlclient_10/Mono.Security/Mono.Security/Mono.Security.Protocol.Tls/ExchangeAlgorithmType.cs,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** ExchangeAlgorithmType.cs 10 Feb 2004 09:43:42 -0000 1.1 --- ExchangeAlgorithmType.cs 18 Feb 2004 15:41:42 -0000 1.2 *************** *** 27,30 **** --- 27,31 ---- namespace Mono.Security.Protocol.Tls { + [Serializable] public enum ExchangeAlgorithmType { Index: HashAlgorithmType.cs =================================================================== RCS file: /cvsroot/pgsqlclient/pgsqlclient_10/Mono.Security/Mono.Security/Mono.Security.Protocol.Tls/HashAlgorithmType.cs,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** HashAlgorithmType.cs 10 Feb 2004 09:43:42 -0000 1.1 --- HashAlgorithmType.cs 18 Feb 2004 15:41:42 -0000 1.2 *************** *** 27,30 **** --- 27,31 ---- namespace Mono.Security.Protocol.Tls { + [Serializable] public enum HashAlgorithmType { |
From: <car...@us...> - 2004-02-18 15:42:01
|
Update of /cvsroot/pgsqlclient/pgsqlclient_10/Mono.Security In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv30124 Modified Files: changelog.txt Log Message: 2004-02-18 Carlos Guzmán Álvarez <car...@te...> * Mono.Security.Protocol.Tls/CipherSuite.cs: * Mono.Security.Protocol.Tls/TlsCipherSuite.cs: * Mono.Security.Protocol.Tls/TlsSslCipherSuite.cs: * Mono.Security.Protocol.Tls/TlsContext.cs: - Added some optimizations proposed by Sebastien Pouliot. * Mono.Security.Protocol.Tls.Handshake.Client/TlsServerCertificate.cs: - Changes on Common Name detection and certificate error handling ( Thanks to Sebastien Pouliot for his feedback ). * Mono.Security.Protocol.Tls/SecurityProtocolType.cs: - Added Serializable attribute ( Thanks to Sebastien Pouliot for his feedback ). * Mono.Security.Protocol.Tls/SslClientStream.cs: - Fix for ServerCertificate property Index: changelog.txt =================================================================== RCS file: /cvsroot/pgsqlclient/pgsqlclient_10/Mono.Security/changelog.txt,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** changelog.txt 17 Feb 2004 22:05:58 -0000 1.5 --- changelog.txt 18 Feb 2004 15:32:17 -0000 1.6 *************** *** 3,6 **** --- 3,27 ---- + 2004-02-18 Carlos Guzmán Álvarez <car...@te...> + + * Mono.Security.Protocol.Tls/CipherSuite.cs: + * Mono.Security.Protocol.Tls/TlsCipherSuite.cs: + * Mono.Security.Protocol.Tls/TlsSslCipherSuite.cs: + * Mono.Security.Protocol.Tls/TlsContext.cs: + + - Added some optimizations proposed by Sebastien Pouliot. + + * Mono.Security.Protocol.Tls.Handshake.Client/TlsServerCertificate.cs: + + - Changes on Common Name detection and certificate error handling ( Thanks to Sebastien Pouliot for his feedback ). + + * Mono.Security.Protocol.Tls/SecurityProtocolType.cs: + + - Added Serializable attribute ( Thanks to Sebastien Pouliot for his feedback ). + + * Mono.Security.Protocol.Tls/SslClientStream.cs: + + - Fix for ServerCertificate property + 2004-02-17 Carlos Guzmán Álvarez <car...@te...> |
Update of /cvsroot/pgsqlclient/pgsqlclient_10/Mono.Security/Mono.Security/Mono.Security.Protocol.Tls In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv29139 Modified Files: CipherSuite.cs SecurityProtocolType.cs SslClientStream.cs TlsCipherSuite.cs TlsContext.cs TlsSslCipherSuite.cs Log Message: 2004-02-18 Carlos Guzmán Álvarez <car...@te...> * Mono.Security.Protocol.Tls/CipherSuite.cs: * Mono.Security.Protocol.Tls/TlsCipherSuite.cs: * Mono.Security.Protocol.Tls/TlsSslCipherSuite.cs: * Mono.Security.Protocol.Tls/TlsContext.cs: - Added some optimizations proposed by Sebastien Pouliot. * Mono.Security.Protocol.Tls.Handshake.Client/TlsServerCertificate.cs: - Changes on Common Name detection and certificate error handling ( Thanks to Sebastien Pouliot for his feedback ). * Mono.Security.Protocol.Tls/SecurityProtocolType.cs: - Added Serializable attribute ( Thanks to Sebastien Pouliot for his feedback ). * Mono.Security.Protocol.Tls/SslClientStream.cs: - Fix for ServerCertificate property Index: CipherSuite.cs =================================================================== RCS file: /cvsroot/pgsqlclient/pgsqlclient_10/Mono.Security/Mono.Security/Mono.Security.Protocol.Tls/CipherSuite.cs,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** CipherSuite.cs 17 Feb 2004 17:52:12 -0000 1.2 --- CipherSuite.cs 18 Feb 2004 15:28:13 -0000 1.3 *************** *** 37,40 **** --- 37,46 ---- internal abstract class CipherSuite { + #region Static Fields + + public static byte[] EmptyArray = new byte[0]; + + #endregion + #region Fields *************** *** 221,225 **** this.ivSize = ivSize; this.blockSize = blockSize; ! this.keyBlockSize = this.keyMaterialSize*2 + this.HashSize*2 + this.ivSize*2; } --- 227,231 ---- this.ivSize = ivSize; this.blockSize = blockSize; ! this.keyBlockSize = (this.keyMaterialSize + this.HashSize + this.ivSize) << 1; } Index: SecurityProtocolType.cs =================================================================== RCS file: /cvsroot/pgsqlclient/pgsqlclient_10/Mono.Security/Mono.Security/Mono.Security.Protocol.Tls/SecurityProtocolType.cs,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** SecurityProtocolType.cs 17 Feb 2004 17:52:12 -0000 1.2 --- SecurityProtocolType.cs 18 Feb 2004 15:28:13 -0000 1.3 *************** *** 28,31 **** --- 28,32 ---- { [Flags] + [Serializable] public enum SecurityProtocolType { Index: SslClientStream.cs =================================================================== RCS file: /cvsroot/pgsqlclient/pgsqlclient_10/Mono.Security/Mono.Security/Mono.Security.Protocol.Tls/SslClientStream.cs,v retrieving revision 1.7 retrieving revision 1.8 diff -C2 -d -r1.7 -r1.8 *** SslClientStream.cs 17 Feb 2004 22:04:16 -0000 1.7 --- SslClientStream.cs 18 Feb 2004 15:28:13 -0000 1.8 *************** *** 222,226 **** get { ! if (!this.context.HandshakeFinished) { if (this.context.ServerSettings.Certificates != null && --- 222,226 ---- get { ! if (this.context.HandshakeFinished) { if (this.context.ServerSettings.Certificates != null && Index: TlsCipherSuite.cs =================================================================== RCS file: /cvsroot/pgsqlclient/pgsqlclient_10/Mono.Security/Mono.Security/Mono.Security.Protocol.Tls/TlsCipherSuite.cs,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** TlsCipherSuite.cs 17 Feb 2004 17:52:12 -0000 1.2 --- TlsCipherSuite.cs 18 Feb 2004 15:28:13 -0000 1.3 *************** *** 126,131 **** else { ! this.Context.ClientWriteIV = new byte[0]; ! this.Context.ServerWriteIV = new byte[0]; } } --- 126,131 ---- else { ! this.Context.ClientWriteIV = CipherSuite.EmptyArray; ! this.Context.ServerWriteIV = CipherSuite.EmptyArray; } } Index: TlsContext.cs =================================================================== RCS file: /cvsroot/pgsqlclient/pgsqlclient_10/Mono.Security/Mono.Security/Mono.Security.Protocol.Tls/TlsContext.cs,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** TlsContext.cs 17 Feb 2004 22:04:55 -0000 1.3 --- TlsContext.cs 18 Feb 2004 15:28:13 -0000 1.4 *************** *** 89,92 **** --- 89,96 ---- private TlsStream handshakeMessages; + + // Secure Random generator + private RandomNumberGenerator random; + #endregion *************** *** 96,99 **** --- 100,104 ---- internal const short TLS1_PROTOCOL_CODE = (0x03 << 8) | 0x01; internal const short SSL3_PROTOCOL_CODE = (0x03 << 8) | 0x00; + internal const long UNIX_BASE_TICKS = 621355968000000000; #endregion *************** *** 292,295 **** --- 297,301 ---- this.handshakeMessages = new TlsStream(); this.sessionId = null; + this.random = RandomNumberGenerator.Create(); // Set client settings *************** *** 304,311 **** public int GetUnixTime() { ! DateTime now = DateTime.Now.ToUniversalTime(); ! TimeSpan unixTime = now.Subtract(new DateTime(1970, 1, 1)); ! ! return (int)unixTime.TotalSeconds; } --- 310,316 ---- public int GetUnixTime() { ! DateTime now = DateTime.UtcNow; ! ! return (int)(now.Ticks - UNIX_BASE_TICKS / TimeSpan.TicksPerSecond); } *************** *** 314,319 **** byte[] secureBytes = new byte[count]; ! RNGCryptoServiceProvider rng = new RNGCryptoServiceProvider(); ! rng.GetNonZeroBytes(secureBytes); return secureBytes; --- 319,323 ---- byte[] secureBytes = new byte[count]; ! this.random.GetNonZeroBytes(secureBytes); return secureBytes; Index: TlsSslCipherSuite.cs =================================================================== RCS file: /cvsroot/pgsqlclient/pgsqlclient_10/Mono.Security/Mono.Security/Mono.Security.Protocol.Tls/TlsSslCipherSuite.cs,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** TlsSslCipherSuite.cs 10 Feb 2004 09:43:42 -0000 1.1 --- TlsSslCipherSuite.cs 18 Feb 2004 15:28:13 -0000 1.2 *************** *** 190,195 **** else { ! this.Context.ClientWriteIV = new byte[0]; ! this.Context.ServerWriteIV = new byte[0]; } } --- 190,195 ---- else { ! this.Context.ClientWriteIV = CipherSuite.EmptyArray; ! this.Context.ServerWriteIV = CipherSuite.EmptyArray; } } |
From: <car...@us...> - 2004-02-17 22:15:33
|
Update of /cvsroot/pgsqlclient/pgsqlclient_10 In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv1034 Modified Files: changelog.txt Log Message: 2004-02-17 Carlos Guzmán Álvarez <car...@te...> * Mono.Security.Protocol.Tls/SslClientStream.cs: - Added changes for check that the handshake is finished to the security properties. Index: changelog.txt =================================================================== RCS file: /cvsroot/pgsqlclient/pgsqlclient_10/changelog.txt,v retrieving revision 1.90 retrieving revision 1.91 diff -C2 -d -r1.90 -r1.91 *** changelog.txt 17 Feb 2004 17:52:50 -0000 1.90 --- changelog.txt 17 Feb 2004 22:06:23 -0000 1.91 *************** *** 4,7 **** --- 4,12 ---- 2004-02-17 Carlos Guzmán Álvarez <car...@te...> + * Mono.Security.Protocol.Tls/SslClientStream.cs: + + - Added changes for check that the handshake is finished + to the security properties. + * Mono.Security.Protocol.Tls.Handshake.Client/TlsClientCertificate.cs: |
From: <car...@us...> - 2004-02-17 22:15:07
|
Update of /cvsroot/pgsqlclient/pgsqlclient_10/Mono.Security In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv943 Modified Files: changelog.txt Log Message: 2004-02-17 Carlos Guzmán Álvarez <car...@te...> * Mono.Security.Protocol.Tls/SslClientStream.cs: - Added changes for check that the handshake is finished to the security properties. Index: changelog.txt =================================================================== RCS file: /cvsroot/pgsqlclient/pgsqlclient_10/Mono.Security/changelog.txt,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** changelog.txt 17 Feb 2004 17:52:29 -0000 1.4 --- changelog.txt 17 Feb 2004 22:05:58 -0000 1.5 *************** *** 5,8 **** --- 5,13 ---- 2004-02-17 Carlos Guzmán Álvarez <car...@te...> + * Mono.Security.Protocol.Tls/SslClientStream.cs: + + - Added changes for check that the handshake is finished + to the security properties. + * Mono.Security.Protocol.Tls.Handshake.Client/TlsClientCertificate.cs: |
From: <car...@us...> - 2004-02-17 22:14:05
|
Update of /cvsroot/pgsqlclient/pgsqlclient_10/Mono.Security/Mono.Security/Mono.Security.Protocol.Tls In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv725 Modified Files: TlsContext.cs Log Message: Region name change Index: TlsContext.cs =================================================================== RCS file: /cvsroot/pgsqlclient/pgsqlclient_10/Mono.Security/Mono.Security/Mono.Security.Protocol.Tls/TlsContext.cs,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** TlsContext.cs 17 Feb 2004 17:52:12 -0000 1.2 --- TlsContext.cs 17 Feb 2004 22:04:55 -0000 1.3 *************** *** 349,353 **** #endregion ! #region EXCEPTION_METHODS internal TlsException CreateException(TlsAlertLevel alertLevel, TlsAlertDescription alertDesc) --- 349,353 ---- #endregion ! #region Exception Methods internal TlsException CreateException(TlsAlertLevel alertLevel, TlsAlertDescription alertDesc) |
From: <car...@us...> - 2004-02-17 22:13:43
|
Update of /cvsroot/pgsqlclient/pgsqlclient_10/Mono.Security/Mono.Security/Mono.Security.Protocol.Tls In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv572 Modified Files: SslClientStream.cs Log Message: Added changes for check that the handshake is finished to the security properties. Index: SslClientStream.cs =================================================================== RCS file: /cvsroot/pgsqlclient/pgsqlclient_10/Mono.Security/Mono.Security/Mono.Security.Protocol.Tls/SslClientStream.cs,v retrieving revision 1.6 retrieving revision 1.7 diff -C2 -d -r1.6 -r1.7 *** SslClientStream.cs 17 Feb 2004 17:52:12 -0000 1.6 --- SslClientStream.cs 17 Feb 2004 22:04:16 -0000 1.7 *************** *** 127,136 **** public CipherAlgorithmType CipherAlgorithm { ! get { return this.context.Cipher.CipherAlgorithmType;} } public int CipherStrength { ! get { return this.context.Cipher.EffectiveKeyBits;} } --- 127,152 ---- public CipherAlgorithmType CipherAlgorithm { ! get ! { ! if (this.context.HandshakeFinished) ! { ! return this.context.Cipher.CipherAlgorithmType; ! } ! ! return CipherAlgorithmType.None; ! } } public int CipherStrength { ! get ! { ! if (this.context.HandshakeFinished) ! { ! return this.context.Cipher.EffectiveKeyBits; ! } ! ! return 0; ! } } *************** *** 142,151 **** public HashAlgorithmType HashAlgorithm { ! get { return this.context.Cipher.HashAlgorithmType; } } public int HashStrength { ! get { return this.context.Cipher.HashSize * 8; } } --- 158,183 ---- public HashAlgorithmType HashAlgorithm { ! get ! { ! if (this.context.HandshakeFinished) ! { ! return this.context.Cipher.HashAlgorithmType; ! } ! ! return HashAlgorithmType.None; ! } } public int HashStrength { ! get ! { ! if (this.context.HandshakeFinished) ! { ! return this.context.Cipher.HashSize * 8; ! } ! ! return 0; ! } } *************** *** 154,158 **** get { ! return this.context.ServerSettings.Certificates[0].RSA.KeySize; } } --- 186,195 ---- get { ! if (this.context.HandshakeFinished) ! { ! return this.context.ServerSettings.Certificates[0].RSA.KeySize; ! } ! ! return 0; } } *************** *** 160,164 **** public ExchangeAlgorithmType KeyExchangeAlgorithm { ! get { return this.context.Cipher.ExchangeAlgorithmType; } } --- 197,209 ---- public ExchangeAlgorithmType KeyExchangeAlgorithm { ! get ! { ! if (this.context.HandshakeFinished) ! { ! return this.context.Cipher.ExchangeAlgorithmType; ! } ! ! return ExchangeAlgorithmType.None; ! } } |
From: <car...@us...> - 2004-02-17 18:01:52
|
Update of /cvsroot/pgsqlclient/pgsqlclient_10 In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv10259 Modified Files: changelog.txt Log Message: 2004-02-17 Carlos Guzmán Álvarez <car...@te...> * Mono.Security.Protocol.Tls.Handshake.Client/TlsClientCertificate.cs: - Raise the Client Certificate event. * Mono.Security.Protocol.Tls/CipherSuite.cs: * Mono.Security.Protocol.Tls/SslClientStream.cs: * Mono.Security.Protocol.Tls/SecurityProtocolType.cs: * Mono.Security.Protocol.Tls/TlsCipherSuite.cs: * Mono.Security.Protocol.Tls/TlsCipherSuiteCollection.cs: * Mono.Security.Protocol.Tls/TlsCipherSuiteFactory.cs: * Mono.Security.Protocol.Tls/TlsContext.cs: * Mono.Security.Protocol.Tls.Handshake/TlsHandshakeMessage.cs: * Mono.Security.Protocol.Tls.Handshake.Client/TlsClientHello.cs: - Change the SecurityProtocolType enum to mtch .NET 1.2 documentation definition. * Mono.Security.Protocol.Tls/SslClientStream.cs: - Impement SelectedClientCertificate and ServerCertificate properties. Index: changelog.txt =================================================================== RCS file: /cvsroot/pgsqlclient/pgsqlclient_10/changelog.txt,v retrieving revision 1.89 retrieving revision 1.90 diff -C2 -d -r1.89 -r1.90 *** changelog.txt 16 Feb 2004 15:29:23 -0000 1.89 --- changelog.txt 17 Feb 2004 17:52:50 -0000 1.90 *************** *** 2,5 **** --- 2,27 ---- ------------------------------------------------------- + 2004-02-17 Carlos Guzmán Álvarez <car...@te...> + + * Mono.Security.Protocol.Tls.Handshake.Client/TlsClientCertificate.cs: + + - Raise the Client Certificate event. + + * Mono.Security.Protocol.Tls/CipherSuite.cs: + * Mono.Security.Protocol.Tls/SslClientStream.cs: + * Mono.Security.Protocol.Tls/SecurityProtocolType.cs: + * Mono.Security.Protocol.Tls/TlsCipherSuite.cs: + * Mono.Security.Protocol.Tls/TlsCipherSuiteCollection.cs: + * Mono.Security.Protocol.Tls/TlsCipherSuiteFactory.cs: + * Mono.Security.Protocol.Tls/TlsContext.cs: + * Mono.Security.Protocol.Tls.Handshake/TlsHandshakeMessage.cs: + * Mono.Security.Protocol.Tls.Handshake.Client/TlsClientHello.cs: + + - Change the SecurityProtocolType enum to mtch .NET 1.2 documentation definition. + + * Mono.Security.Protocol.Tls/SslClientStream.cs: + + - Impement SelectedClientCertificate and ServerCertificate properties. + 2004-02-16 Carlos Guzmán Álvarez <car...@te...> |
From: <car...@us...> - 2004-02-17 18:01:31
|
Update of /cvsroot/pgsqlclient/pgsqlclient_10/Mono.Security In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv10199 Modified Files: changelog.txt Log Message: 2004-02-17 Carlos Guzmán Álvarez <car...@te...> * Mono.Security.Protocol.Tls.Handshake.Client/TlsClientCertificate.cs: - Raise the Client Certificate event. * Mono.Security.Protocol.Tls/CipherSuite.cs: * Mono.Security.Protocol.Tls/SslClientStream.cs: * Mono.Security.Protocol.Tls/SecurityProtocolType.cs: * Mono.Security.Protocol.Tls/TlsCipherSuite.cs: * Mono.Security.Protocol.Tls/TlsCipherSuiteCollection.cs: * Mono.Security.Protocol.Tls/TlsCipherSuiteFactory.cs: * Mono.Security.Protocol.Tls/TlsContext.cs: * Mono.Security.Protocol.Tls.Handshake/TlsHandshakeMessage.cs: * Mono.Security.Protocol.Tls.Handshake.Client/TlsClientHello.cs: - Change the SecurityProtocolType enum to mtch .NET 1.2 documentation definition. * Mono.Security.Protocol.Tls/SslClientStream.cs: - Impement SelectedClientCertificate and ServerCertificate properties. Index: changelog.txt =================================================================== RCS file: /cvsroot/pgsqlclient/pgsqlclient_10/Mono.Security/changelog.txt,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** changelog.txt 16 Feb 2004 15:28:56 -0000 1.3 --- changelog.txt 17 Feb 2004 17:52:29 -0000 1.4 *************** *** 3,6 **** --- 3,33 ---- + 2004-02-17 Carlos Guzmán Álvarez <car...@te...> + + * Mono.Security.Protocol.Tls.Handshake.Client/TlsClientCertificate.cs: + + - Raise the Client Certificate event. + + * Mono.Security.Protocol.Tls/CipherSuite.cs: + * Mono.Security.Protocol.Tls/SslClientStream.cs: + * Mono.Security.Protocol.Tls/SecurityProtocolType.cs: + * Mono.Security.Protocol.Tls/TlsCipherSuite.cs: + * Mono.Security.Protocol.Tls/TlsCipherSuiteCollection.cs: + * Mono.Security.Protocol.Tls/TlsCipherSuiteFactory.cs: + * Mono.Security.Protocol.Tls/TlsContext.cs: + * Mono.Security.Protocol.Tls.Handshake/TlsHandshakeMessage.cs: + * Mono.Security.Protocol.Tls.Handshake.Client/TlsClientHello.cs: + + - Change the SecurityProtocolType enum to mtch .NET 1.2 documentation definition. + + * Mono.Security.Protocol.Tls/SslClientStream.cs: + + - Impement SelectedClientCertificate and ServerCertificate properties. + + * Mono.Security.Protocol.Tls/SslClientStream.cs: + + - Added changes for implement Async methods ( Tanks to Sebastien Pouliot ) + + 2004-02-16 Carlos Guzmán Álvarez <car...@te...> |
From: <car...@us...> - 2004-02-17 18:01:14
|
Update of /cvsroot/pgsqlclient/pgsqlclient_10/Mono.Security/Mono.Security/Mono.Security.Protocol.Tls In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv10160 Modified Files: CipherSuite.cs SecurityProtocolType.cs SslClientStream.cs TlsCipherSuite.cs TlsCipherSuiteCollection.cs TlsCipherSuiteFactory.cs TlsContext.cs Log Message: 2004-02-17 Carlos Guzmán Álvarez <car...@te...> * Mono.Security.Protocol.Tls.Handshake.Client/TlsClientCertificate.cs: - Raise the Client Certificate event. * Mono.Security.Protocol.Tls/CipherSuite.cs: * Mono.Security.Protocol.Tls/SslClientStream.cs: * Mono.Security.Protocol.Tls/SecurityProtocolType.cs: * Mono.Security.Protocol.Tls/TlsCipherSuite.cs: * Mono.Security.Protocol.Tls/TlsCipherSuiteCollection.cs: * Mono.Security.Protocol.Tls/TlsCipherSuiteFactory.cs: * Mono.Security.Protocol.Tls/TlsContext.cs: * Mono.Security.Protocol.Tls.Handshake/TlsHandshakeMessage.cs: * Mono.Security.Protocol.Tls.Handshake.Client/TlsClientHello.cs: - Change the SecurityProtocolType enum to mtch .NET 1.2 documentation definition. * Mono.Security.Protocol.Tls/SslClientStream.cs: - Impement SelectedClientCertificate and ServerCertificate properties. Index: CipherSuite.cs =================================================================== RCS file: /cvsroot/pgsqlclient/pgsqlclient_10/Mono.Security/Mono.Security/Mono.Security.Protocol.Tls/CipherSuite.cs,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** CipherSuite.cs 10 Feb 2004 09:43:42 -0000 1.1 --- CipherSuite.cs 17 Feb 2004 17:52:12 -0000 1.2 *************** *** 350,354 **** // Write protocol version ! stream.Write((short)this.Context.Protocol); // Generate random bytes --- 350,354 ---- // Write protocol version ! stream.Write(this.Context.Protocol); // Generate random bytes Index: SecurityProtocolType.cs =================================================================== RCS file: /cvsroot/pgsqlclient/pgsqlclient_10/Mono.Security/Mono.Security/Mono.Security.Protocol.Tls/SecurityProtocolType.cs,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** SecurityProtocolType.cs 10 Feb 2004 09:43:42 -0000 1.1 --- SecurityProtocolType.cs 17 Feb 2004 17:52:12 -0000 1.2 *************** *** 27,35 **** namespace Mono.Security.Protocol.Tls { ! public enum SecurityProtocolType : short { ! Default = (0x03 << 8) | 0x01, ! Ssl3 = (0x03 << 8) | 0x00, ! Tls = (0x03 << 8) | 0x01 } } \ No newline at end of file --- 27,37 ---- namespace Mono.Security.Protocol.Tls { ! [Flags] ! public enum SecurityProtocolType { ! Default = -1073741824, ! Ssl2 = 12, ! Ssl3 = 48, ! Tls = 192 } } \ No newline at end of file Index: SslClientStream.cs =================================================================== RCS file: /cvsroot/pgsqlclient/pgsqlclient_10/Mono.Security/Mono.Security/Mono.Security.Protocol.Tls/SslClientStream.cs,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** SslClientStream.cs 17 Feb 2004 16:52:53 -0000 1.5 --- SslClientStream.cs 17 Feb 2004 17:52:12 -0000 1.6 *************** *** 165,169 **** public SecurityProtocolType SecurityProtocol { ! get { return this.context.Protocol; } } --- 165,169 ---- public SecurityProtocolType SecurityProtocol { ! get { return this.context.SecurityProtocol; } } *************** *** 643,649 **** } ! TlsContentType contentType = (TlsContentType)type; ! SecurityProtocolType protocol = (SecurityProtocolType)this.ReadShort(); ! short length = this.ReadShort(); // Read Record data --- 643,649 ---- } ! TlsContentType contentType = (TlsContentType)type; ! short protocol = this.ReadShort(); ! short length = this.ReadShort(); // Read Record data *************** *** 675,679 **** message = this.decryptRecordFragment( contentType, - protocol, message.ToArray()); } --- 675,678 ---- *************** *** 821,825 **** // Write tls message record.Write((byte)contentType); ! record.Write((short)this.context.Protocol); record.Write((short)fragment.Length); record.Write(fragment); --- 820,824 ---- // Write tls message record.Write((byte)contentType); ! record.Write(this.context.Protocol); record.Write((short)fragment.Length); record.Write(fragment); *************** *** 861,867 **** private TlsStream decryptRecordFragment( ! TlsContentType contentType, ! SecurityProtocolType protocol, ! byte[] fragment) { byte[] dcrFragment = null; --- 860,865 ---- private TlsStream decryptRecordFragment( ! TlsContentType contentType, ! byte[] fragment) { byte[] dcrFragment = null; *************** *** 1008,1012 **** { // Obtain supported cipher suite collection ! this.context.SupportedCiphers = TlsCipherSuiteFactory.GetSupportedCiphers(context.Protocol); // Send client hello --- 1006,1010 ---- { // Obtain supported cipher suite collection ! this.context.SupportedCiphers = TlsCipherSuiteFactory.GetSupportedCiphers(context.SecurityProtocol); // Send client hello Index: TlsCipherSuite.cs =================================================================== RCS file: /cvsroot/pgsqlclient/pgsqlclient_10/Mono.Security/Mono.Security/Mono.Security.Protocol.Tls/TlsCipherSuite.cs,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** TlsCipherSuite.cs 10 Feb 2004 09:43:42 -0000 1.1 --- TlsCipherSuite.cs 17 Feb 2004 17:52:12 -0000 1.2 *************** *** 61,65 **** data.Write(this.Context.ReadSequenceNumber); data.Write((byte)contentType); ! data.Write((short)this.Context.Protocol); data.Write((short)fragment.Length); data.Write(fragment); --- 61,65 ---- data.Write(this.Context.ReadSequenceNumber); data.Write((byte)contentType); ! data.Write(this.Context.Protocol); data.Write((short)fragment.Length); data.Write(fragment); *************** *** 79,83 **** data.Write(this.Context.WriteSequenceNumber); data.Write((byte)contentType); ! data.Write((short)this.Context.Protocol); data.Write((short)fragment.Length); data.Write(fragment); --- 79,83 ---- data.Write(this.Context.WriteSequenceNumber); data.Write((byte)contentType); ! data.Write(this.Context.Protocol); data.Write((short)fragment.Length); data.Write(fragment); Index: TlsCipherSuiteCollection.cs =================================================================== RCS file: /cvsroot/pgsqlclient/pgsqlclient_10/Mono.Security/Mono.Security/Mono.Security.Protocol.Tls/TlsCipherSuiteCollection.cs,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** TlsCipherSuiteCollection.cs 10 Feb 2004 09:43:42 -0000 1.1 --- TlsCipherSuiteCollection.cs 17 Feb 2004 17:52:12 -0000 1.2 *************** *** 118,137 **** switch (this.protocol) { ! case SecurityProtocolType.Ssl3: return this.add( ! new TlsSslCipherSuite( code, name, cipherType, hashType, exchangeType, exportable, blockMode, keyMaterialSize, expandedKeyMaterialSize, effectiveKeyBytes, ivSize, blockSize)); ! case SecurityProtocolType.Tls: return this.add( ! new TlsCipherSuite( code, name, cipherType, hashType, exchangeType, exportable, blockMode, keyMaterialSize, expandedKeyMaterialSize, effectiveKeyBytes, ivSize, blockSize)); default: ! throw new NotSupportedException(); } } --- 118,139 ---- switch (this.protocol) { ! case SecurityProtocolType.Default: ! case SecurityProtocolType.Tls: return this.add( ! new TlsCipherSuite( code, name, cipherType, hashType, exchangeType, exportable, blockMode, keyMaterialSize, expandedKeyMaterialSize, effectiveKeyBytes, ivSize, blockSize)); ! case SecurityProtocolType.Ssl3: return this.add( ! new TlsSslCipherSuite( code, name, cipherType, hashType, exchangeType, exportable, blockMode, keyMaterialSize, expandedKeyMaterialSize, effectiveKeyBytes, ivSize, blockSize)); + case SecurityProtocolType.Ssl2: default: ! throw new NotSupportedException("Unsupported security protocol type."); } } Index: TlsCipherSuiteFactory.cs =================================================================== RCS file: /cvsroot/pgsqlclient/pgsqlclient_10/Mono.Security/Mono.Security/Mono.Security.Protocol.Tls/TlsCipherSuiteFactory.cs,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** TlsCipherSuiteFactory.cs 16 Feb 2004 15:28:40 -0000 1.2 --- TlsCipherSuiteFactory.cs 17 Feb 2004 17:52:12 -0000 1.3 *************** *** 33,44 **** switch (protocol) { case SecurityProtocolType.Ssl3: return TlsCipherSuiteFactory.GetSsl3SupportedCiphers(); ! case SecurityProtocolType.Tls: ! return TlsCipherSuiteFactory.GetTls1SupportedCiphers(); ! default: ! throw new NotSupportedException(); } } --- 33,46 ---- switch (protocol) { + case SecurityProtocolType.Default: + case SecurityProtocolType.Tls: + return TlsCipherSuiteFactory.GetTls1SupportedCiphers(); + case SecurityProtocolType.Ssl3: return TlsCipherSuiteFactory.GetSsl3SupportedCiphers(); ! case SecurityProtocolType.Ssl2: default: ! throw new NotSupportedException("Unsupported security protocol type"); } } Index: TlsContext.cs =================================================================== RCS file: /cvsroot/pgsqlclient/pgsqlclient_10/Mono.Security/Mono.Security/Mono.Security.Protocol.Tls/TlsContext.cs,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** TlsContext.cs 10 Feb 2004 09:43:42 -0000 1.1 --- TlsContext.cs 17 Feb 2004 17:52:12 -0000 1.2 *************** *** 43,47 **** // Protocol version ! private SecurityProtocolType protocol; // Sesison ID --- 43,47 ---- // Protocol version ! private SecurityProtocolType securityProtocol; // Sesison ID *************** *** 91,97 **** #endregion ! #region INTERNAL_CONSTANTS ! internal const short MAX_FRAGMENT_SIZE = 16384; // 2^14 #endregion --- 91,99 ---- #endregion ! #region Internal Constants ! internal const short MAX_FRAGMENT_SIZE = 16384; // 2^14 ! internal const short TLS1_PROTOCOL_CODE = (0x03 << 8) | 0x01; ! internal const short SSL3_PROTOCOL_CODE = (0x03 << 8) | 0x00; #endregion *************** *** 104,111 **** } ! public SecurityProtocolType Protocol { ! get { return this.protocol; } ! set { this.protocol = value; } } --- 106,133 ---- } ! public SecurityProtocolType SecurityProtocol { ! get { return this.securityProtocol; } ! set { this.securityProtocol = value; } ! } ! ! public short Protocol ! { ! get ! { ! switch (this.securityProtocol) ! { ! case SecurityProtocolType.Tls: ! case SecurityProtocolType.Default: ! return TLS1_PROTOCOL_CODE; ! ! case SecurityProtocolType.Ssl3: ! return SSL3_PROTOCOL_CODE; ! ! case SecurityProtocolType.Ssl2: ! default: ! throw new NotSupportedException("Unsupported security protocol type"); ! } ! } } *************** *** 258,268 **** public TlsContext( ! SslClientStream sslStream, ! SecurityProtocolType securityProtocolType, ! string targetHost, ! X509CertificateCollection clientCertificates) { this.sslStream = sslStream; ! this.protocol = securityProtocolType; this.compressionMethod = SecurityCompressionType.None; this.serverSettings = new TlsServerSettings(); --- 280,290 ---- public TlsContext( ! SslClientStream sslStream, ! SecurityProtocolType securityProtocolType, ! string targetHost, ! X509CertificateCollection clientCertificates) { this.sslStream = sslStream; ! this.securityProtocol = securityProtocolType; this.compressionMethod = SecurityCompressionType.None; this.serverSettings = new TlsServerSettings(); *************** *** 318,322 **** // Clear MAC keys if protocol is different than Ssl3 ! if (this.protocol != SecurityProtocolType.Ssl3) { this.clientWriteMAC = null; --- 340,344 ---- // Clear MAC keys if protocol is different than Ssl3 ! if (this.securityProtocol != SecurityProtocolType.Ssl3) { this.clientWriteMAC = null; |
From: <car...@us...> - 2004-02-17 18:00:31
|
Update of /cvsroot/pgsqlclient/pgsqlclient_10/Mono.Security/Mono.Security/Mono.Security.Protocol.Tls.Handshake In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv10045 Modified Files: TlsHandshakeMessage.cs Log Message: 2004-02-17 Carlos Guzmán Álvarez <car...@te...> * Mono.Security.Protocol.Tls.Handshake.Client/TlsClientCertificate.cs: - Raise the Client Certificate event. * Mono.Security.Protocol.Tls/CipherSuite.cs: * Mono.Security.Protocol.Tls/SslClientStream.cs: * Mono.Security.Protocol.Tls/SecurityProtocolType.cs: * Mono.Security.Protocol.Tls/TlsCipherSuite.cs: * Mono.Security.Protocol.Tls/TlsCipherSuiteCollection.cs: * Mono.Security.Protocol.Tls/TlsCipherSuiteFactory.cs: * Mono.Security.Protocol.Tls/TlsContext.cs: * Mono.Security.Protocol.Tls.Handshake/TlsHandshakeMessage.cs: * Mono.Security.Protocol.Tls.Handshake.Client/TlsClientHello.cs: - Change the SecurityProtocolType enum to mtch .NET 1.2 documentation definition. * Mono.Security.Protocol.Tls/SslClientStream.cs: - Impement SelectedClientCertificate and ServerCertificate properties. Index: TlsHandshakeMessage.cs =================================================================== RCS file: /cvsroot/pgsqlclient/pgsqlclient_10/Mono.Security/Mono.Security/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 10 Feb 2004 09:44:45 -0000 1.1 --- TlsHandshakeMessage.cs 17 Feb 2004 17:51:26 -0000 1.2 *************** *** 105,117 **** private void process() { ! switch (this.Context.Protocol) { case SecurityProtocolType.Ssl3: this.ProcessAsSsl3(); break; ! case SecurityProtocolType.Tls: ! this.ProcessAsTls1(); ! break; } } --- 105,122 ---- private void process() { ! switch (this.Context.SecurityProtocol) { + case SecurityProtocolType.Tls: + case SecurityProtocolType.Default: + this.ProcessAsTls1(); + break; + case SecurityProtocolType.Ssl3: this.ProcessAsSsl3(); break; ! case SecurityProtocolType.Ssl2: ! default: ! throw new NotSupportedException("Unsupported security protocol type"); } } |
From: <car...@us...> - 2004-02-17 18:00:09
|
Update of /cvsroot/pgsqlclient/pgsqlclient_10/Mono.Security/Mono.Security/Mono.Security.Protocol.Tls.Handshake.Client In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv9999 Modified Files: TlsClientCertificate.cs TlsClientHello.cs Log Message: 2004-02-17 Carlos Guzmán Álvarez <car...@te...> * Mono.Security.Protocol.Tls.Handshake.Client/TlsClientCertificate.cs: - Raise the Client Certificate event. * Mono.Security.Protocol.Tls/CipherSuite.cs: * Mono.Security.Protocol.Tls/SslClientStream.cs: * Mono.Security.Protocol.Tls/SecurityProtocolType.cs: * Mono.Security.Protocol.Tls/TlsCipherSuite.cs: * Mono.Security.Protocol.Tls/TlsCipherSuiteCollection.cs: * Mono.Security.Protocol.Tls/TlsCipherSuiteFactory.cs: * Mono.Security.Protocol.Tls/TlsContext.cs: * Mono.Security.Protocol.Tls.Handshake/TlsHandshakeMessage.cs: * Mono.Security.Protocol.Tls.Handshake.Client/TlsClientHello.cs: - Change the SecurityProtocolType enum to mtch .NET 1.2 documentation definition. * Mono.Security.Protocol.Tls/SslClientStream.cs: - Impement SelectedClientCertificate and ServerCertificate properties. Index: TlsClientCertificate.cs =================================================================== RCS file: /cvsroot/pgsqlclient/pgsqlclient_10/Mono.Security/Mono.Security/Mono.Security.Protocol.Tls.Handshake.Client/TlsClientCertificate.cs,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** TlsClientCertificate.cs 17 Feb 2004 16:56:05 -0000 1.2 --- TlsClientCertificate.cs 17 Feb 2004 17:51:06 -0000 1.3 *************** *** 72,79 **** clientCert = this.Context.SslStream.RaiseClientCertificateSelection( ! this.Context.ClientSettings.Certificates, ! this.Context.ServerSettings.Certificates[0], ! this.Context.ClientSettings.TargetHost, ! null); if (clientCert == null) --- 72,79 ---- clientCert = this.Context.SslStream.RaiseClientCertificateSelection( ! this.Context.ClientSettings.Certificates, ! new X509Certificate(this.Context.ServerSettings.Certificates[0].RawData), ! this.Context.ClientSettings.TargetHost, ! null); if (clientCert == null) Index: TlsClientHello.cs =================================================================== RCS file: /cvsroot/pgsqlclient/pgsqlclient_10/Mono.Security/Mono.Security/Mono.Security.Protocol.Tls.Handshake.Client/TlsClientHello.cs,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** TlsClientHello.cs 10 Feb 2004 09:45:30 -0000 1.1 --- TlsClientHello.cs 17 Feb 2004 17:51:06 -0000 1.2 *************** *** 68,72 **** { // Client Version ! this.Write((short)this.Context.Protocol); // Random bytes - Unix time + Radom bytes [28] --- 68,72 ---- { // Client Version ! this.Write(this.Context.Protocol); // Random bytes - Unix time + Radom bytes [28] |
From: <car...@us...> - 2004-02-17 17:05:05
|
Update of /cvsroot/pgsqlclient/pgsqlclient_10/Mono.Security/Mono.Security/Mono.Security.Protocol.Tls.Handshake.Client In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv31171 Modified Files: TlsClientCertificate.cs Log Message: Bring to work the ClientCertSslection delegate Index: TlsClientCertificate.cs =================================================================== RCS file: /cvsroot/pgsqlclient/pgsqlclient_10/Mono.Security/Mono.Security/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 10 Feb 2004 09:45:30 -0000 1.1 --- TlsClientCertificate.cs 17 Feb 2004 16:56:05 -0000 1.2 *************** *** 60,63 **** --- 60,65 ---- protected override void ProcessAsTls1() { + #warning "Client certificate selection is unfinished" + if (this.Context.ClientSettings.Certificates == null || this.Context.ClientSettings.Certificates.Count == 0) *************** *** 69,73 **** X509Certificate clientCert = this.Context.ClientSettings.Certificates[0]; - /* clientCert = this.Context.SslStream.RaiseClientCertificateSelection( this.Context.ClientSettings.Certificates, --- 71,74 ---- *************** *** 75,80 **** this.Context.ClientSettings.TargetHost, null); ! */ ! this.Context.ClientSettings.ClientCertificate = clientCert; --- 76,86 ---- this.Context.ClientSettings.TargetHost, null); ! ! if (clientCert == null) ! { ! throw this.Context.CreateException("Client certificate requested by the server and no client certificate specified."); ! } ! ! // Update the selected client certificate this.Context.ClientSettings.ClientCertificate = clientCert; |
From: <car...@us...> - 2004-02-17 17:01:52
|
Update of /cvsroot/pgsqlclient/pgsqlclient_10/Mono.Security/Mono.Security/Mono.Security.Protocol.Tls In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv30475 Modified Files: SslClientStream.cs Log Message: - Implemente SelectedClientCertificate and ServerCErtificate properties. - Changed record fragmentation. Index: SslClientStream.cs =================================================================== RCS file: /cvsroot/pgsqlclient/pgsqlclient_10/Mono.Security/Mono.Security/Mono.Security.Protocol.Tls/SslClientStream.cs,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** SslClientStream.cs 17 Feb 2004 14:18:12 -0000 1.4 --- SslClientStream.cs 17 Feb 2004 16:52:53 -0000 1.5 *************** *** 170,179 **** public X509Certificate SelectedClientCertificate { ! get { throw new NotImplementedException(); } } public X509Certificate ServerCertificate { ! get { throw new NotImplementedException(); } } --- 170,191 ---- public X509Certificate SelectedClientCertificate { ! get { return this.context.ClientSettings.ClientCertificate; } } public X509Certificate ServerCertificate { ! get ! { ! if (!this.context.HandshakeFinished) ! { ! if (this.context.ServerSettings.Certificates != null && ! this.context.ServerSettings.Certificates.Count > 0) ! { ! return new X509Certificate(this.context.ServerSettings.Certificates[0].RawData); ! } ! } ! ! return null; ! } } *************** *** 480,489 **** this.checkDisposed(); - if (!this.context.HandshakeFinished) - { - // Start handshake negotiation - this.doHandshake(); - } - if (buffer == null) { --- 492,495 ---- *************** *** 507,510 **** --- 513,522 ---- } + if (!this.context.HandshakeFinished) + { + // Start handshake negotiation + this.doHandshake(); + } + if (!Monitor.TryEnter(this.write)) { *************** *** 781,809 **** TlsStream record = new TlsStream(); - byte[][] fragments = this.fragmentData(recordData, offset, count); - for (int i = 0; i < fragments.Length; i++) - { - byte[] fragment = fragments[i]; - - if (this.context.IsActual) - { - // Encrypt fragment - fragment = this.encryptRecordFragment(contentType, fragment); - } - - // Write tls message - record.Write((byte)contentType); - record.Write((short)this.context.Protocol); - record.Write((short)fragment.Length); - record.Write(fragment); - } - - return record.ToArray(); - } - - private byte[][] fragmentData(byte[] messageData, int offset, int count) - { - ArrayList d = new ArrayList(); - int position = offset; --- 793,796 ---- *************** *** 811,815 **** { short fragmentLength = 0; ! byte[] fragmentData; if ((count - position) > TlsContext.MAX_FRAGMENT_SIZE) { --- 798,803 ---- { short fragmentLength = 0; ! byte[] fragment; ! if ((count - position) > TlsContext.MAX_FRAGMENT_SIZE) { *************** *** 820,841 **** fragmentLength = (short)(count - position); } - fragmentData = new byte[fragmentLength]; ! System.Array.Copy(messageData, position, fragmentData, 0, fragmentLength); ! d.Add(fragmentData); ! position += fragmentLength; ! } ! byte[][] result = new byte[d.Count][]; ! for (int i = 0; i < d.Count; i++) ! { ! result[i] = (byte[])d[i]; } ! return result; } ! #endregion --- 808,835 ---- fragmentLength = (short)(count - position); } ! // Fill the fragment data ! fragment = new byte[fragmentLength]; ! Buffer.BlockCopy(recordData, position, fragment, 0, fragmentLength); ! if (this.context.IsActual) ! { ! // Encrypt fragment ! fragment = this.encryptRecordFragment(contentType, fragment); ! } ! // Write tls message ! record.Write((byte)contentType); ! record.Write((short)this.context.Protocol); ! record.Write((short)fragment.Length); ! record.Write(fragment); ! // Update buffer position ! position += fragmentLength; } ! return record.ToArray(); } ! #endregion |
From: <car...@us...> - 2004-02-17 14:27:07
|
Update of /cvsroot/pgsqlclient/pgsqlclient_10/Mono.Security/Mono.Security/Mono.Security.Protocol.Tls In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv30037 Modified Files: SslClientStream.cs Log Message: 2004-02-17 Carlos Guzmán Álvarez <car...@te...> * Mono.Security.Protocol.Tls/SslClientStream.cs: - Added changes for implement Async methods ( Tanks to Sebastien Pouliot ) Index: SslClientStream.cs =================================================================== RCS file: /cvsroot/pgsqlclient/pgsqlclient_10/Mono.Security/Mono.Security/Mono.Security.Protocol.Tls/SslClientStream.cs,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** SslClientStream.cs 17 Feb 2004 13:11:28 -0000 1.3 --- SslClientStream.cs 17 Feb 2004 14:18:12 -0000 1.4 *************** *** 229,273 **** public SslClientStream( ! Stream stream, ! string targetHost, ! bool ownsStream) ! : this(stream, targetHost, ! ownsStream, SecurityProtocolType.Default, null) { } public SslClientStream( ! Stream stream, string targetHost, X509Certificate clientCertificate) : ! this( ! stream, targetHost, ! false, SecurityProtocolType.Default, ! new X509CertificateCollection(new X509Certificate[]{clientCertificate})) { } public SslClientStream( ! Stream stream, ! string targetHost, X509CertificateCollection clientCertificates) : ! this(stream, targetHost, false, ! SecurityProtocolType.Default, clientCertificates) { } public SslClientStream( ! Stream stream, ! string targetHost, ! bool ownsStream, ! SecurityProtocolType securityProtocolType) : ! this(stream, targetHost, ownsStream, securityProtocolType, ! new X509CertificateCollection()) { } public SslClientStream( ! Stream stream, ! string targetHost, ! bool ownsStream, ! SecurityProtocolType securityProtocolType, ! X509CertificateCollection clientCertificates) { if (stream == null) --- 229,278 ---- public SslClientStream( ! Stream stream, ! string targetHost, ! bool ownsStream) ! : this( ! stream, targetHost, ownsStream, ! SecurityProtocolType.Default, null) { } public SslClientStream( ! Stream stream, ! string targetHost, ! X509Certificate clientCertificate) ! : this( ! stream, targetHost, false, SecurityProtocolType.Default, ! new X509CertificateCollection(new X509Certificate[]{clientCertificate})) { } public SslClientStream( ! Stream stream, ! string targetHost, ! X509CertificateCollection clientCertificates) : ! this( ! stream, targetHost, false, SecurityProtocolType.Default, ! clientCertificates) { } public SslClientStream( ! Stream stream, ! string targetHost, ! bool ownsStream, ! SecurityProtocolType securityProtocolType) ! : this( ! stream, targetHost, ownsStream, securityProtocolType, ! new X509CertificateCollection()) { } public SslClientStream( ! Stream stream, ! string targetHost, ! bool ownsStream, ! SecurityProtocolType securityProtocolType, ! X509CertificateCollection clientCertificates) { if (stream == null) *************** *** 336,341 **** } } ! this.ownsStream = false; ! this.innerStream = null; if (this.ClientCertSelection != null) { --- 341,346 ---- } } ! this.ownsStream = false; ! this.innerStream = null; if (this.ClientCertSelection != null) { *************** *** 359,372 **** public override IAsyncResult BeginRead( ! byte[] buffer, ! int offset, ! int count, ! AsyncCallback callback, ! object state) { ! if (this.disposed) ! { ! throw new ObjectDisposedException("The SslClientStream is closed."); ! } if (buffer == null) --- 364,374 ---- public override IAsyncResult BeginRead( ! byte[] buffer, ! int offset, ! int count, ! AsyncCallback callback, ! object state) { ! this.checkDisposed(); if (buffer == null) *************** *** 391,453 **** } - throw new NotSupportedException(); - } - - public override IAsyncResult BeginWrite( - byte[] buffer, - int offset, - int count, - AsyncCallback callback, - object state) - { - throw new NotSupportedException(); - } - - public override int EndRead(IAsyncResult asyncResult) - { - if (this.disposed) - { - throw new ObjectDisposedException("The SslClientStream is closed."); - } - if (asyncResult == null) - { - throw new ArgumentNullException("asyncResult is null or was not obtained by calling BeginRead."); - } - - throw new NotSupportedException(); - } - - public override void EndWrite(IAsyncResult asyncResult) - { - throw new NotSupportedException(); - } - - public override void Close() - { - ((IDisposable)this).Dispose(); - } - - public override void Flush() - { - if (this.disposed) - { - throw new ObjectDisposedException("The SslClientStream is closed."); - } - - this.innerStream.Flush(); - } - - public int Read(byte[] buffer) - { - return this.Read(buffer, 0, buffer.Length); - } - - public override int Read(byte[] buffer, int offset, int count) - { - if (this.disposed) - { - throw new ObjectDisposedException("The SslClientStream is closed."); - } - if (!this.context.HandshakeFinished) { --- 393,396 ---- *************** *** 455,483 **** } - if (buffer == null) - { - throw new ArgumentNullException("buffer is a null reference."); - } - if (offset < 0) - { - throw new ArgumentOutOfRangeException("offset is less than 0."); - } - if (offset > buffer.Length) - { - throw new ArgumentOutOfRangeException("offset is greater than the length of buffer."); - } - if (count < 0) - { - throw new ArgumentOutOfRangeException("count is less than 0."); - } - if (count > (buffer.Length - offset)) - { - throw new ArgumentOutOfRangeException("count is less than the length of buffer minus the value of the offset parameter."); - } - if (!Monitor.TryEnter(this.read)) { throw new InvalidOperationException("A read operation is already in progress."); } try { --- 398,408 ---- } if (!Monitor.TryEnter(this.read)) { throw new InvalidOperationException("A read operation is already in progress."); } + + IAsyncResult asyncResult; + try { *************** *** 527,531 **** } ! return this.inputBuffer.Read(buffer, offset, count); } catch (TlsException ex) --- 452,457 ---- } ! asyncResult = this.inputBuffer.BeginRead( ! buffer, offset, count, callback, state); } catch (TlsException ex) *************** *** 541,567 **** System.Threading.Monitor.Exit(this.read); } - } ! public override long Seek(long offset, SeekOrigin origin) ! { ! throw new NotSupportedException(); ! } ! ! public override void SetLength(long value) ! { ! throw new NotSupportedException(); ! } ! ! public void Write(byte[] buffer) ! { ! this.Write(buffer, 0, buffer.Length); } ! public override void Write(byte[] buffer, int offset, int count) { ! if (this.disposed) ! { ! throw new ObjectDisposedException("The SslClientStream is closed."); ! } if (!this.context.HandshakeFinished) --- 467,482 ---- System.Threading.Monitor.Exit(this.read); } ! return asyncResult; } ! public override IAsyncResult BeginWrite( ! byte[] buffer, ! int offset, ! int count, ! AsyncCallback callback, ! object state) { ! this.checkDisposed(); if (!this.context.HandshakeFinished) *************** *** 596,599 **** --- 511,517 ---- throw new InvalidOperationException("A write operation is already in progress."); } + + IAsyncResult asyncResult; + try { *************** *** 601,608 **** // Send the buffer as a TLS record ! byte[] recordData = new byte[count]; ! System.Array.Copy(buffer, offset, recordData, 0, count); ! ! this.sendRecord(TlsContentType.ApplicationData, recordData); } catch (TlsException ex) --- 519,527 ---- // Send the buffer as a TLS record ! byte[] record = this.encodeRecord( ! TlsContentType.ApplicationData, buffer, offset, count); ! ! asyncResult = this.innerStream.BeginWrite( ! record, 0, record.Length, callback, state); } catch (TlsException ex) *************** *** 618,621 **** --- 537,612 ---- Monitor.Exit(this.write); } + + return asyncResult; + } + + public override int EndRead(IAsyncResult asyncResult) + { + this.checkDisposed(); + + if (asyncResult == null) + { + throw new ArgumentNullException("asyncResult is null or was not obtained by calling BeginRead."); + } + + return this.inputBuffer.EndRead(asyncResult); + } + + public override void EndWrite(IAsyncResult asyncResult) + { + this.checkDisposed(); + + if (asyncResult == null) + { + throw new ArgumentNullException("asyncResult is null or was not obtained by calling BeginRead."); + } + + this.innerStream.EndWrite (asyncResult); + } + + public override void Close() + { + ((IDisposable)this).Dispose(); + } + + public override void Flush() + { + this.checkDisposed(); + + this.innerStream.Flush(); + } + + public int Read(byte[] buffer) + { + return this.Read(buffer, 0, buffer.Length); + } + + public override int Read(byte[] buffer, int offset, int count) + { + IAsyncResult res = this.BeginRead(buffer, offset, count, null, null); + + return this.EndRead(res); + } + + public override long Seek(long offset, SeekOrigin origin) + { + throw new NotSupportedException(); + } + + public override void SetLength(long value) + { + throw new NotSupportedException(); + } + + public void Write(byte[] buffer) + { + this.Write(buffer, 0, buffer.Length); + } + + public override void Write(byte[] buffer, int offset, int count) + { + IAsyncResult res = this.BeginWrite (buffer, offset, count, null, null); + + this.EndWrite(res); } *************** *** 727,733 **** } private void sendRecord(TlsHandshakeType type) { ! TlsHandshakeMessage msg = createClientHandshakeMessage(type); // Write record --- 718,739 ---- } + private void sendChangeCipherSpec() + { + // Send Change Cipher Spec message + this.sendRecord(TlsContentType.ChangeCipherSpec, new byte[] {1}); + + // Reset sequence numbers + this.context.WriteSequenceNumber = 0; + + // Make the pending state to be the current state + this.context.IsActual = true; + + // Send Finished message + this.sendRecord(TlsHandshakeType.Finished); + } + private void sendRecord(TlsHandshakeType type) { ! TlsHandshakeMessage msg = this.createClientHandshakeMessage(type); // Write record *************** *** 741,760 **** } ! private void sendChangeCipherSpec() { ! // Send Change Cipher Spec message ! this.sendRecord(TlsContentType.ChangeCipherSpec, new byte[] {1}); ! // Reset sequence numbers ! this.context.WriteSequenceNumber = 0; ! // Make the pending state to be the current state ! this.context.IsActual = true; ! // Send Finished message ! this.sendRecord(TlsHandshakeType.Finished); } ! ! private void sendRecord(TlsContentType contentType, byte[] recordData) { if (this.context.ConnectionEnd) --- 747,776 ---- } ! private void sendRecord(TlsContentType contentType, byte[] recordData) { ! if (this.context.ConnectionEnd) ! { ! throw this.context.CreateException("The session is finished and it's no longer valid."); ! } ! byte[] record = this.encodeRecord(contentType, recordData); ! this.innerStream.Write(record, 0, record.Length); ! } ! private byte[] encodeRecord(TlsContentType contentType, byte[] recordData) ! { ! return this.encodeRecord( ! contentType, ! recordData, ! 0, ! recordData.Length); } ! ! private byte[] encodeRecord( ! TlsContentType contentType, ! byte[] recordData, ! int offset, ! int count) { if (this.context.ConnectionEnd) *************** *** 763,767 **** } ! byte[][] fragments = this.fragmentData(recordData); for (int i = 0; i < fragments.Length; i++) { --- 779,785 ---- } ! TlsStream record = new TlsStream(); ! ! byte[][] fragments = this.fragmentData(recordData, offset, count); for (int i = 0; i < fragments.Length; i++) { *************** *** 775,803 **** // Write tls message - TlsStream record = new TlsStream(); record.Write((byte)contentType); record.Write((short)this.context.Protocol); record.Write((short)fragment.Length); record.Write(fragment); - - // Write record - this.innerStream.Write(record.ToArray(), 0, (int)record.Length); - - // Reset record data - record.Reset(); } - } ! private byte[][] fragmentData(byte[] messageData) { ArrayList d = new ArrayList(); ! int position = 0; ! while (position < messageData.Length) { short fragmentLength = 0; byte[] fragmentData; ! if ((messageData.Length - position) > TlsContext.MAX_FRAGMENT_SIZE) { fragmentLength = TlsContext.MAX_FRAGMENT_SIZE; --- 793,816 ---- // Write tls message record.Write((byte)contentType); record.Write((short)this.context.Protocol); record.Write((short)fragment.Length); record.Write(fragment); } ! return record.ToArray(); ! } ! ! private byte[][] fragmentData(byte[] messageData, int offset, int count) { ArrayList d = new ArrayList(); ! int position = offset; ! while (position < ( offset + count )) { short fragmentLength = 0; byte[] fragmentData; ! if ((count - position) > TlsContext.MAX_FRAGMENT_SIZE) { fragmentLength = TlsContext.MAX_FRAGMENT_SIZE; *************** *** 805,809 **** else { ! fragmentLength = (short)(messageData.Length - position); } fragmentData = new byte[fragmentLength]; --- 818,822 ---- else { ! fragmentLength = (short)(count - position); } fragmentData = new byte[fragmentLength]; *************** *** 829,833 **** #region Cryptography Methods ! private byte[] encryptRecordFragment(TlsContentType contentType, byte[] fragment) { // Calculate message MAC --- 842,848 ---- #region Cryptography Methods ! private byte[] encryptRecordFragment( ! TlsContentType contentType, ! byte[] fragment) { // Calculate message MAC *************** *** 851,857 **** } ! private TlsStream decryptRecordFragment(TlsContentType contentType, ! SecurityProtocolType protocol, ! byte[] fragment) { byte[] dcrFragment = null; --- 866,873 ---- } ! private TlsStream decryptRecordFragment( ! TlsContentType contentType, ! SecurityProtocolType protocol, ! byte[] fragment) { byte[] dcrFragment = null; *************** *** 917,921 **** } ! private void processAlert(TlsAlertLevel alertLevel, TlsAlertDescription alertDesc) { switch (alertLevel) --- 933,939 ---- } ! private void processAlert( ! TlsAlertLevel alertLevel, ! TlsAlertDescription alertDesc) { switch (alertLevel) *************** *** 960,963 **** --- 978,989 ---- } + private void checkDisposed() + { + if (this.disposed) + { + throw new ObjectDisposedException("The SslClientStream is closed."); + } + } + #endregion |
From: <car...@us...> - 2004-02-17 13:20:20
|
Update of /cvsroot/pgsqlclient/pgsqlclient_10/Mono.Security/Mono.Security/Mono.Security.Protocol.Tls In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv16813 Modified Files: SslClientStream.cs Log Message: Fix for the close method Index: SslClientStream.cs =================================================================== RCS file: /cvsroot/pgsqlclient/pgsqlclient_10/Mono.Security/Mono.Security/Mono.Security.Protocol.Tls/SslClientStream.cs,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** SslClientStream.cs 15 Feb 2004 21:50:14 -0000 1.2 --- SslClientStream.cs 17 Feb 2004 13:11:28 -0000 1.3 *************** *** 51,56 **** public delegate AsymmetricAlgorithm PrivateKeySelectionCallback( ! X509Certificate clientCertificate, ! string targetHost); #endregion --- 51,56 ---- public delegate AsymmetricAlgorithm PrivateKeySelectionCallback( ! X509Certificate clientCertificate, ! string targetHost); #endregion *************** *** 323,329 **** if (this.innerStream != null) { ! // Write close notify ! TlsCloseNotifyAlert alert = new TlsCloseNotifyAlert(this.context); ! this.SendAlert(alert); if (this.ownsStream) --- 323,332 ---- if (this.innerStream != null) { ! if (this.context.HandshakeFinished) ! { ! // Write close notify ! TlsCloseNotifyAlert alert = new TlsCloseNotifyAlert(this.context); ! this.SendAlert(alert); ! } if (this.ownsStream) |
From: <car...@us...> - 2004-02-16 15:40:37
|
Update of /cvsroot/pgsqlclient/pgsqlclient_10 In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv29787 Modified Files: PgSqlClient.build Log Message: Updated build file Index: PgSqlClient.build =================================================================== RCS file: /cvsroot/pgsqlclient/pgsqlclient_10/PgSqlClient.build,v retrieving revision 1.13 retrieving revision 1.14 diff -C2 -d -r1.13 -r1.14 *** PgSqlClient.build 10 Feb 2004 09:56:04 -0000 1.13 --- PgSqlClient.build 16 Feb 2004 15:32:27 -0000 1.14 *************** *** 196,199 **** --- 196,200 ---- </references> <arg value="/optimize+" /> + <arg value="/unsafe" /> </csc> </target> *************** *** 220,224 **** <arg value="/resource:${resources.dir}\Toolbox\PgDataAdapter.bmp,PostgreSql.Data.PgSqlClient.Resources.ToolBox.PgDataAdapter.bmp" /> <arg value="/optimize+" /> - <arg value="/unsafe" /> </csc> </target> --- 221,224 ---- |
From: <car...@us...> - 2004-02-16 15:37:32
|
Update of /cvsroot/pgsqlclient/pgsqlclient_10 In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv29267 Modified Files: changelog.txt Log Message: 2004-02-16 Carlos Guzmán Álvarez <car...@te...> * Mono.Security.Protocol.Tls/TlsCipherSuiteFactory.cs: - Changed the cipher suites preference order ( Thanks to Sebastien Pouliot for his feedback ) Index: changelog.txt =================================================================== RCS file: /cvsroot/pgsqlclient/pgsqlclient_10/changelog.txt,v retrieving revision 1.88 retrieving revision 1.89 diff -C2 -d -r1.88 -r1.89 *** changelog.txt 16 Feb 2004 11:52:35 -0000 1.88 --- changelog.txt 16 Feb 2004 15:29:23 -0000 1.89 *************** *** 2,6 **** ------------------------------------------------------- ! 2004-2-15 Carlos Guzmán Álvarez <car...@te...> * Mono.Security.Protocol.Tls/SslClientStream.cs: --- 2,12 ---- ------------------------------------------------------- ! 2004-02-16 Carlos Guzmán Álvarez <car...@te...> ! ! * Mono.Security.Protocol.Tls/TlsCipherSuiteFactory.cs: ! ! - Changed the cipher suites preference order ( Thanks to Sebastien Pouliot for his feedback ) ! ! 2004-02-15 Carlos Guzmán Álvarez <car...@te...> * Mono.Security.Protocol.Tls/SslClientStream.cs: |
From: <car...@us...> - 2004-02-16 15:37:04
|
Update of /cvsroot/pgsqlclient/pgsqlclient_10/Mono.Security In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv29157 Modified Files: changelog.txt Log Message: 2004-02-16 Carlos Guzmán Álvarez <car...@te...> * Mono.Security.Protocol.Tls/TlsCipherSuiteFactory.cs: - Changed the cipher suites preference order ( Thanks to Sebastien Pouliot for his feedback ) Index: changelog.txt =================================================================== RCS file: /cvsroot/pgsqlclient/pgsqlclient_10/Mono.Security/changelog.txt,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** changelog.txt 15 Feb 2004 21:50:32 -0000 1.2 --- changelog.txt 16 Feb 2004 15:28:56 -0000 1.3 *************** *** 2,6 **** --------------- ----------- ----------------------------------------- ! 2004-2-15 Carlos Guzmán Álvarez <car...@te...> * Mono.Security.Protocol.Tls/SslClientStream.cs: --- 2,14 ---- --------------- ----------- ----------------------------------------- ! ! 2004-02-16 Carlos Guzmán Álvarez <car...@te...> ! ! * Mono.Security.Protocol.Tls/TlsCipherSuiteFactory.cs: ! ! - Changed the cipher suites preference order ( Thanks to Sebastien Pouliot for his feedback ) ! ! ! 2004-02-15 Carlos Guzmán Álvarez <car...@te...> * Mono.Security.Protocol.Tls/SslClientStream.cs: *************** *** 11,15 **** - Removed test code. ! 2004-2-10 Carlos Guzmán Álvarez <car...@te...> * Mono.Security.Cryptography/PKCS1.cs --- 19,23 ---- - Removed test code. ! 2004-02-10 Carlos Guzmán Álvarez <car...@te...> * Mono.Security.Cryptography/PKCS1.cs *************** *** 17,21 **** - Fixed typo. ! 2004-2-09 Carlos Guzmán Álvarez <car...@te...> * Changed license headers to remove accents. --- 25,29 ---- - Fixed typo. ! 2004-02-09 Carlos Guzmán Álvarez <car...@te...> * Changed license headers to remove accents. |
From: <car...@us...> - 2004-02-16 15:36:48
|
Update of /cvsroot/pgsqlclient/pgsqlclient_10/Mono.Security/Mono.Security/Mono.Security.Protocol.Tls In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv29081 Modified Files: TlsCipherSuiteFactory.cs Log Message: 2004-02-16 Carlos Guzmán Álvarez <car...@te...> * Mono.Security.Protocol.Tls/TlsCipherSuiteFactory.cs: - Changed the cipher suites preference order ( Thanks to Sebastien Pouliot for his feedback ) Index: TlsCipherSuiteFactory.cs =================================================================== RCS file: /cvsroot/pgsqlclient/pgsqlclient_10/Mono.Security/Mono.Security/Mono.Security.Protocol.Tls/TlsCipherSuiteFactory.cs,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** TlsCipherSuiteFactory.cs 10 Feb 2004 09:43:42 -0000 1.1 --- TlsCipherSuiteFactory.cs 16 Feb 2004 15:28:40 -0000 1.2 *************** *** 54,60 **** scs.Add((0x00 << 0x08) | 0x2F, "TLS_RSA_WITH_AES_128_CBC_SHA", CipherAlgorithmType.Rijndael, HashAlgorithmType.Sha1, ExchangeAlgorithmType.RsaSign, false, true, 16, 16, 128, 16, 16); scs.Add((0x00 << 0x08) | 0x0A, "TLS_RSA_WITH_3DES_EDE_CBC_SHA", CipherAlgorithmType.TripleDes, HashAlgorithmType.Sha1, ExchangeAlgorithmType.RsaSign, false, true, 24, 24, 168, 8, 8); - scs.Add((0x00 << 0x08) | 0x09, "TLS_RSA_WITH_DES_CBC_SHA", CipherAlgorithmType.Des, HashAlgorithmType.Sha1, ExchangeAlgorithmType.RsaSign, false, true, 8, 8, 56, 8, 8); scs.Add((0x00 << 0x08) | 0x05, "TLS_RSA_WITH_RC4_128_SHA", CipherAlgorithmType.Rc4, HashAlgorithmType.Sha1, ExchangeAlgorithmType.RsaSign, false, false, 16, 16, 128, 0, 0); scs.Add((0x00 << 0x08) | 0x04, "TLS_RSA_WITH_RC4_128_MD5", CipherAlgorithmType.Rc4, HashAlgorithmType.Md5, ExchangeAlgorithmType.RsaSign, false, false, 16, 16, 128, 0, 0); // Default CipherSuite --- 54,60 ---- scs.Add((0x00 << 0x08) | 0x2F, "TLS_RSA_WITH_AES_128_CBC_SHA", CipherAlgorithmType.Rijndael, HashAlgorithmType.Sha1, ExchangeAlgorithmType.RsaSign, false, true, 16, 16, 128, 16, 16); scs.Add((0x00 << 0x08) | 0x0A, "TLS_RSA_WITH_3DES_EDE_CBC_SHA", CipherAlgorithmType.TripleDes, HashAlgorithmType.Sha1, ExchangeAlgorithmType.RsaSign, false, true, 24, 24, 168, 8, 8); scs.Add((0x00 << 0x08) | 0x05, "TLS_RSA_WITH_RC4_128_SHA", CipherAlgorithmType.Rc4, HashAlgorithmType.Sha1, ExchangeAlgorithmType.RsaSign, false, false, 16, 16, 128, 0, 0); scs.Add((0x00 << 0x08) | 0x04, "TLS_RSA_WITH_RC4_128_MD5", CipherAlgorithmType.Rc4, HashAlgorithmType.Md5, ExchangeAlgorithmType.RsaSign, false, false, 16, 16, 128, 0, 0); + scs.Add((0x00 << 0x08) | 0x09, "TLS_RSA_WITH_DES_CBC_SHA", CipherAlgorithmType.Des, HashAlgorithmType.Sha1, ExchangeAlgorithmType.RsaSign, false, true, 8, 8, 56, 8, 8); // Default CipherSuite *************** *** 121,127 **** // Supported ciphers scs.Add((0x00 << 0x08) | 0x0A, "SSL_RSA_WITH_3DES_EDE_CBC_SHA", CipherAlgorithmType.TripleDes, HashAlgorithmType.Sha1, ExchangeAlgorithmType.RsaSign, false, true, 24, 24, 168, 8, 8); - scs.Add((0x00 << 0x08) | 0x09, "SSL_RSA_WITH_DES_CBC_SHA", CipherAlgorithmType.Des, HashAlgorithmType.Sha1, ExchangeAlgorithmType.RsaSign, false, true, 8, 8, 56, 8, 8); scs.Add((0x00 << 0x08) | 0x05, "SSL_RSA_WITH_RC4_128_SHA", CipherAlgorithmType.Rc4, HashAlgorithmType.Sha1, ExchangeAlgorithmType.RsaSign, false, false, 16, 16, 128, 0, 0); scs.Add((0x00 << 0x08) | 0x04, "SSL_RSA_WITH_RC4_128_MD5", CipherAlgorithmType.Rc4, HashAlgorithmType.Md5, ExchangeAlgorithmType.RsaSign, false, false, 16, 16, 128, 0, 0); // Default CipherSuite --- 121,127 ---- // Supported ciphers scs.Add((0x00 << 0x08) | 0x0A, "SSL_RSA_WITH_3DES_EDE_CBC_SHA", CipherAlgorithmType.TripleDes, HashAlgorithmType.Sha1, ExchangeAlgorithmType.RsaSign, false, true, 24, 24, 168, 8, 8); scs.Add((0x00 << 0x08) | 0x05, "SSL_RSA_WITH_RC4_128_SHA", CipherAlgorithmType.Rc4, HashAlgorithmType.Sha1, ExchangeAlgorithmType.RsaSign, false, false, 16, 16, 128, 0, 0); scs.Add((0x00 << 0x08) | 0x04, "SSL_RSA_WITH_RC4_128_MD5", CipherAlgorithmType.Rc4, HashAlgorithmType.Md5, ExchangeAlgorithmType.RsaSign, false, false, 16, 16, 128, 0, 0); + scs.Add((0x00 << 0x08) | 0x09, "SSL_RSA_WITH_DES_CBC_SHA", CipherAlgorithmType.Des, HashAlgorithmType.Sha1, ExchangeAlgorithmType.RsaSign, false, true, 8, 8, 56, 8, 8); // Default CipherSuite |