[pgsqlclient-checkins] pgsqlclient_10/Mono.Security/Mono.Security/Mono.Security.Protocol.Tls SslClie
Status: Inactive
Brought to you by:
carlosga_fb
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 |