| Update of /cvsroot/pgsqlclient/pgsqlclient_10/Mono.Security.Protocol.Tls/Mono.Security.Protocol.Tls
In directory sc8-pr-cvs1:/tmp/cvs-serv22688
Modified Files:
	CipherSuite.cs 
Log Message:
2003-11-04 Carlos Guzmán Álvarez <car...@te...>
	* CipherSuite.cs:
		- Added custom padding for record encryption.
Index: CipherSuite.cs
===================================================================
RCS file: /cvsroot/pgsqlclient/pgsqlclient_10/Mono.Security.Protocol.Tls/Mono.Security.Protocol.Tls/CipherSuite.cs,v
retrieving revision 1.5
retrieving revision 1.6
diff -C2 -d -r1.5 -r1.6
*** CipherSuite.cs	3 Nov 2003 20:34:30 -0000	1.5
--- CipherSuite.cs	4 Nov 2003 09:18:46 -0000	1.6
***************
*** 250,257 ****
  				// Calculate padding_length
  				int fragmentLength	= fragment.Length + mac.Length + 1;
! 				int paddingLength	= (((fragmentLength/this.BlockSize)*this.BlockSize) + this.BlockSize) - fragmentLength;
  
  				// Write padding length byte
! 				cs.WriteByte((byte)paddingLength);
  			}
  			// cs.FlushFinalBlock();
--- 250,264 ----
  				// Calculate padding_length
  				int fragmentLength	= fragment.Length + mac.Length + 1;
! 				int paddingLength	= this.blockSize - fragmentLength % this.blockSize;
! 				if (paddingLength == this.blockSize)
! 				{
! 					paddingLength = 0;
! 				}
  
  				// Write padding length byte
! 				for (int i = 0; i < (paddingLength + 1); i++)
! 				{
! 					cs.WriteByte((byte)paddingLength);
! 				}
  			}
  			// cs.FlushFinalBlock();
***************
*** 449,453 ****
  				// Configure encrypt algorithm
  				encryptionAlgorithm.Mode		= this.cipherMode;
! 				encryptionAlgorithm.Padding		= PaddingMode.PKCS7;
  				encryptionAlgorithm.KeySize		= this.keyMaterialSize * 8;
  				encryptionAlgorithm.BlockSize	= this.blockSize * 8;
--- 456,460 ----
  				// Configure encrypt algorithm
  				encryptionAlgorithm.Mode		= this.cipherMode;
! 				encryptionAlgorithm.Padding		= PaddingMode.None;
  				encryptionAlgorithm.KeySize		= this.keyMaterialSize * 8;
  				encryptionAlgorithm.BlockSize	= this.blockSize * 8;
 |