[pgsqlclient-checkins] pgsqlclient_10/Mono.Security/Mono.Security/Mono.Security.Protocol.Tls Context
Status: Inactive
Brought to you by:
carlosga_fb
From: <car...@us...> - 2004-03-10 16:06:21
|
Update of /cvsroot/pgsqlclient/pgsqlclient_10/Mono.Security/Mono.Security/Mono.Security.Protocol.Tls In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv23725 Modified Files: Context.cs RecordProtocol.cs SslServerStream.cs Log Message: no message Index: Context.cs =================================================================== RCS file: /cvsroot/pgsqlclient/pgsqlclient_10/Mono.Security/Mono.Security/Mono.Security.Protocol.Tls/Context.cs,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** Context.cs 9 Mar 2004 16:29:21 -0000 1.5 --- Context.cs 10 Mar 2004 15:47:57 -0000 1.6 *************** *** 102,105 **** --- 102,108 ---- private RandomNumberGenerator random; + // Record protocol + private RecordProtocol recordProtocol; + #endregion *************** *** 307,310 **** --- 310,319 ---- } + public RecordProtocol RecordProtocol + { + get { return this.recordProtocol; } + set { this.recordProtocol = value; } + } + #endregion Index: RecordProtocol.cs =================================================================== RCS file: /cvsroot/pgsqlclient/pgsqlclient_10/Mono.Security/Mono.Security/Mono.Security.Protocol.Tls/RecordProtocol.cs,v retrieving revision 1.11 retrieving revision 1.12 diff -C2 -d -r1.11 -r1.12 *** RecordProtocol.cs 10 Mar 2004 12:03:11 -0000 1.11 --- RecordProtocol.cs 10 Mar 2004 15:47:57 -0000 1.12 *************** *** 61,66 **** public RecordProtocol(Stream innerStream, Context context) { ! this.innerStream = innerStream; ! this.context = context; } --- 61,67 ---- public RecordProtocol(Stream innerStream, Context context) { ! this.innerStream = innerStream; ! this.context = context; ! this.context.RecordProtocol = this; } *************** *** 364,375 **** byte[] fragment) { ! byte[] dcrFragment = null; ! byte[] dcrMAC = null; ! // Decrypt message ! this.context.Cipher.DecryptRecord(fragment, ref dcrFragment, ref dcrMAC); ! // Check MAC code byte[] mac = null; if (this.Context is ClientContext) { --- 365,390 ---- byte[] fragment) { ! byte[] dcrFragment = null; ! byte[] dcrMAC = null; ! bool badRecordMac = false; ! try ! { ! // Decrypt message ! this.context.Cipher.DecryptRecord(fragment, ref dcrFragment, ref dcrMAC); ! } ! catch ! { ! if (this.context is ServerContext) ! { ! this.Context.RecordProtocol.SendAlert(AlertDescription.DecryptionFailed); ! } ! ! throw; ! } ! // Generate record MAC byte[] mac = null; + if (this.Context is ClientContext) { *************** *** 381,396 **** } ! // 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."); } } --- 396,424 ---- } ! // Check record MAC if (mac.Length != dcrMAC.Length) { ! badRecordMac = true; ! } ! else ! { ! for (int i = 0; i < mac.Length; i++) ! { ! if (mac[i] != dcrMAC[i]) ! { ! badRecordMac = true; ! break; ! } ! } } ! if (badRecordMac) { ! if (this.context is ServerContext) { ! this.Context.RecordProtocol.SendAlert(AlertDescription.BadRecordMAC); } + + throw new TlsException("Bad record MAC"); } Index: SslServerStream.cs =================================================================== RCS file: /cvsroot/pgsqlclient/pgsqlclient_10/Mono.Security/Mono.Security/Mono.Security.Protocol.Tls/SslServerStream.cs,v retrieving revision 1.9 retrieving revision 1.10 diff -C2 -d -r1.9 -r1.10 *** SslServerStream.cs 9 Mar 2004 20:00:59 -0000 1.9 --- SslServerStream.cs 10 Mar 2004 15:47:57 -0000 1.10 *************** *** 665,669 **** { this.protocol.SendRecord(HandshakeType.ServerKeyExchange); - } --- 665,668 ---- |