[pgsqlclient-checkins] pgsqlclient_10/Mono.Security/Mono.Security/Mono.Security.Protocol.Tls CipherS
Status: Inactive
Brought to you by:
carlosga_fb
Update of /cvsroot/pgsqlclient/pgsqlclient_10/Mono.Security/Mono.Security/Mono.Security.Protocol.Tls In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv19472 Modified Files: CipherSuite.cs RecordProtocol.cs SslServerStream.cs TlsCipherSuite.cs Log Message: 2004-03-09 Carlos Guzman Alvarez <car...@te...> * Mono.Security.Protocol.Tls/Ciphersuite.cs: - Added generation of the Server encryption algorithms. * Mono.Security.Protocol.Tls.Handshake.Server/TlsClientKeyExchange.cs: - Finished processing of the message contents. * Mono.Security.Protocol.Tls/RecordProtocol.cs: * Mono.Security.Protocol.Tls/ClientRecordProtocol.cs: * Mono.Security.Protocol.Tls/ServerRecordProtocol.cs: - Added new ProcessChangeCipherSpec method. * Mono.Security.Protocol.Tls/Context.cs: - Added new PrintBuffer method ( for debug ). Index: CipherSuite.cs =================================================================== RCS file: /cvsroot/pgsqlclient/pgsqlclient_10/Mono.Security/Mono.Security/Mono.Security.Protocol.Tls/CipherSuite.cs,v retrieving revision 1.8 retrieving revision 1.9 diff -C2 -d -r1.8 -r1.9 *** CipherSuite.cs 9 Mar 2004 16:29:20 -0000 1.8 --- CipherSuite.cs 9 Mar 2004 20:00:59 -0000 1.9 *************** *** 503,507 **** this.encryptionCipher = this.encryptionAlgorithm.CreateEncryptor(); ! // Create the HMAC algorithm for the client if (this.context is ClientContext) { --- 503,507 ---- this.encryptionCipher = this.encryptionAlgorithm.CreateEncryptor(); ! // Create the HMAC algorithm if (this.context is ClientContext) { *************** *** 512,516 **** else { ! this.clientHMAC = new M.HMAC( this.HashAlgorithmName, this.context.ServerWriteMAC); --- 512,516 ---- else { ! this.serverHMAC = new M.HMAC( this.HashAlgorithmName, this.context.ServerWriteMAC); *************** *** 569,573 **** this.decryptionCipher = this.decryptionAlgorithm.CreateDecryptor(); ! // Create the HMAC algorithm for the server if (this.context is ClientContext) { --- 569,573 ---- this.decryptionCipher = this.decryptionAlgorithm.CreateDecryptor(); ! // Create the HMAC if (this.context is ClientContext) { *************** *** 578,582 **** else { ! this.serverHMAC = new M.HMAC( this.HashAlgorithmName, this.context.ClientWriteMAC); --- 578,582 ---- else { ! this.clientHMAC = new M.HMAC( this.HashAlgorithmName, this.context.ClientWriteMAC); Index: RecordProtocol.cs =================================================================== RCS file: /cvsroot/pgsqlclient/pgsqlclient_10/Mono.Security/Mono.Security/Mono.Security.Protocol.Tls/RecordProtocol.cs,v retrieving revision 1.8 retrieving revision 1.9 diff -C2 -d -r1.8 -r1.9 *** RecordProtocol.cs 9 Mar 2004 16:29:21 -0000 1.8 --- RecordProtocol.cs 9 Mar 2004 20:00:59 -0000 1.9 *************** *** 233,236 **** --- 233,239 ---- public void SendChangeCipherSpec() { + // Send Change Cipher Spec message as a plain message + this.context.IsActual = false; + // Send Change Cipher Spec message this.SendRecord(ContentType.ChangeCipherSpec, new byte[] {1}); *************** *** 327,332 **** byte[] fragment) { // Calculate message MAC ! byte[] mac = this.context.Cipher.ComputeClientRecordMAC(contentType, fragment); // Encrypt the message --- 330,344 ---- byte[] fragment) { + byte[] mac = null; + // Calculate message MAC ! if (this.Context is ClientContext) ! { ! mac = this.context.Cipher.ComputeClientRecordMAC(contentType, fragment); ! } ! else ! { ! mac = this.context.Cipher.ComputeServerRecordMAC(contentType, fragment); ! } // Encrypt the message *************** *** 338,342 **** 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); } --- 350,362 ---- byte[] iv = new byte[this.context.Cipher.IvSize]; System.Array.Copy(ecr, ecr.Length - iv.Length, iv, 0, iv.Length); ! ! if (this.Context is ClientContext) ! { ! this.context.Cipher.UpdateClientCipherIV(iv); ! } ! else ! { ! this.context.Cipher.UpdateServerCipherIV(iv); ! } } *************** *** 362,370 **** 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 --- 382,406 ---- byte[] iv = new byte[this.context.Cipher.IvSize]; System.Array.Copy(fragment, fragment.Length - iv.Length, iv, 0, iv.Length); ! ! if (this.Context is ClientContext) ! { ! this.context.Cipher.UpdateServerCipherIV(iv); ! } ! else ! { ! this.context.Cipher.UpdateClientCipherIV(iv); ! } } // Check MAC code ! byte[] mac = null; ! if (this.Context is ClientContext) ! { ! mac = this.context.Cipher.ComputeServerRecordMAC(contentType, dcrFragment); ! } ! else ! { ! mac = this.context.Cipher.ComputeClientRecordMAC(contentType, dcrFragment); ! } // Check that the mac is correct Index: SslServerStream.cs =================================================================== RCS file: /cvsroot/pgsqlclient/pgsqlclient_10/Mono.Security/Mono.Security/Mono.Security.Protocol.Tls/SslServerStream.cs,v retrieving revision 1.8 retrieving revision 1.9 diff -C2 -d -r1.8 -r1.9 *** SslServerStream.cs 8 Mar 2004 15:08:42 -0000 1.8 --- SslServerStream.cs 9 Mar 2004 20:00:59 -0000 1.9 *************** *** 685,689 **** this.protocol.ReceiveRecord(); } ! // Send ChangeCipherSpec and ServerFinished messages this.protocol.SendChangeCipherSpec(); --- 685,689 ---- this.protocol.ReceiveRecord(); } ! // Send ChangeCipherSpec and ServerFinished messages this.protocol.SendChangeCipherSpec(); Index: TlsCipherSuite.cs =================================================================== RCS file: /cvsroot/pgsqlclient/pgsqlclient_10/Mono.Security/Mono.Security/Mono.Security.Protocol.Tls/TlsCipherSuite.cs,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** TlsCipherSuite.cs 3 Mar 2004 16:22:36 -0000 1.4 --- TlsCipherSuite.cs 9 Mar 2004 20:00:59 -0000 1.5 *************** *** 59,63 **** byte[] result = null; ! data.Write(this.Context.ReadSequenceNumber); data.Write((byte)contentType); data.Write(this.Context.Protocol); --- 59,71 ---- byte[] result = null; ! if (this.Context is ClientContext) ! { ! data.Write(this.Context.ReadSequenceNumber); ! } ! else ! { ! data.Write(this.Context.WriteSequenceNumber); ! } ! data.Write((byte)contentType); data.Write(this.Context.Protocol); *************** *** 77,81 **** byte[] result = null; ! data.Write(this.Context.WriteSequenceNumber); data.Write((byte)contentType); data.Write(this.Context.Protocol); --- 85,97 ---- byte[] result = null; ! if (this.Context is ClientContext) ! { ! data.Write(this.Context.WriteSequenceNumber); ! } ! else ! { ! data.Write(this.Context.ReadSequenceNumber); ! } ! data.Write((byte)contentType); data.Write(this.Context.Protocol); |