Update of /cvsroot/pgsqlclient/pgsqlclient_10/Mono.Security.Protocol.Tls/Mono.Security.Protocol.Tls
In directory sc8-pr-cvs1:/tmp/cvs-serv16314
Modified Files:
TlsCipherSuiteFactory.cs TlsSslCipherSuite.cs
Log Message:
* TLS implementation:
* TlsCipherSuiteFactory.cs:
- Changed names of private methods.
* TlsSslCipherSuite.cs:
- Replaced implementations of key generation methods with
a throw new NotSupportedException()
Index: TlsCipherSuiteFactory.cs
===================================================================
RCS file: /cvsroot/pgsqlclient/pgsqlclient_10/Mono.Security.Protocol.Tls/Mono.Security.Protocol.Tls/TlsCipherSuiteFactory.cs,v
retrieving revision 1.1
retrieving revision 1.2
diff -C2 -d -r1.1 -r1.2
*** TlsCipherSuiteFactory.cs 20 Oct 2003 10:00:20 -0000 1.1
--- TlsCipherSuiteFactory.cs 21 Oct 2003 09:31:41 -0000 1.2
***************
*** 34,41 ****
{
case TlsProtocol.Tls1:
! return TlsCipherSuiteFactory.GetTlsSupportedCiphers();
case TlsProtocol.Ssl3:
! return TlsCipherSuiteFactory.GetSslSupportedCiphers();
default:
--- 34,41 ----
{
case TlsProtocol.Tls1:
! return TlsCipherSuiteFactory.GetTls1SupportedCiphers();
case TlsProtocol.Ssl3:
! return TlsCipherSuiteFactory.GetSsl3SupportedCiphers();
default:
***************
*** 46,50 ****
#region PRIVATE_STATIC_METHODS
! private static TlsCipherSuiteCollection GetTlsSupportedCiphers()
{
TlsCipherSuiteCollection scs = new TlsCipherSuiteCollection();
--- 46,50 ----
#region PRIVATE_STATIC_METHODS
! private static TlsCipherSuiteCollection GetTls1SupportedCiphers()
{
TlsCipherSuiteCollection scs = new TlsCipherSuiteCollection();
***************
*** 115,119 ****
}
! private static TlsCipherSuiteCollection GetSslSupportedCiphers()
{
TlsCipherSuiteCollection scs = new TlsCipherSuiteCollection();
--- 115,119 ----
}
! private static TlsCipherSuiteCollection GetSsl3SupportedCiphers()
{
TlsCipherSuiteCollection scs = new TlsCipherSuiteCollection();
Index: TlsSslCipherSuite.cs
===================================================================
RCS file: /cvsroot/pgsqlclient/pgsqlclient_10/Mono.Security.Protocol.Tls/Mono.Security.Protocol.Tls/TlsSslCipherSuite.cs,v
retrieving revision 1.1
retrieving revision 1.2
diff -C2 -d -r1.1 -r1.2
*** TlsSslCipherSuite.cs 20 Oct 2003 10:00:20 -0000 1.1
--- TlsSslCipherSuite.cs 21 Oct 2003 09:31:41 -0000 1.2
***************
*** 118,194 ****
public override void CreateMasterSecret(byte[] preMasterSecret)
{
! TlsStream seed = new TlsStream();
!
! // Seed
! seed.Write(context.ClientRandom);
! seed.Write(context.ServerRandom);
!
! // Create master secret
! context.MasterSecret = new byte[preMasterSecret.Length];
! context.MasterSecret = PRF(preMasterSecret, "master secret", seed.ToArray(), 48);
!
! seed.Reset();
}
public override void CreateKeys()
{
! TlsStream seed = new TlsStream();
!
! // Seed
! seed.Write(context.ServerRandom);
! seed.Write(context.ClientRandom);
!
! // Create keyblock
! TlsStream keyBlock = new TlsStream(
! PRF(this.Context.MasterSecret,
! "key expansion",
! seed.ToArray(),
! this.KeyBlockSize));
!
! this.Context.ClientWriteMAC = keyBlock.ReadBytes(this.HashSize);
! this.Context.ServerWriteMAC = keyBlock.ReadBytes(this.HashSize);
! this.Context.ClientWriteKey = keyBlock.ReadBytes(this.KeyMaterialSize);
! this.Context.ServerWriteKey = keyBlock.ReadBytes(this.KeyMaterialSize);
!
! if (!this.IsExportable)
! {
! if (this.IvSize != 0)
! {
! this.Context.ClientWriteIV = keyBlock.ReadBytes(this.IvSize);
! this.Context.ServerWriteIV = keyBlock.ReadBytes(this.IvSize);
! }
! else
! {
! this.Context.ClientWriteIV = new byte[0];
! this.Context.ServerWriteIV = new byte[0];
! }
! }
! else
! {
! // Seed
! seed.Reset();
! seed.Write(this.Context.ClientRandom);
! seed.Write(this.Context.ServerRandom);
!
! // Generate final write keys
! byte[] finalClientWriteKey = PRF(this.Context.ClientWriteKey, "client write key", seed.ToArray(), this.KeyMaterialSize);
! byte[] finalServerWriteKey = PRF(this.Context.ServerWriteKey, "server write key", seed.ToArray(), this.KeyMaterialSize);
!
! this.Context.ClientWriteKey = finalClientWriteKey;
! this.Context.ServerWriteKey = finalServerWriteKey;
!
! // Generate IV block
! byte[] ivBlock = PRF(new byte[]{}, "IV block", seed.ToArray(), this.IvSize*2);
!
! // Generate IV keys
! this.Context.ClientWriteIV = new byte[this.IvSize];
! System.Array.Copy(ivBlock, 0, this.Context.ClientWriteIV, 0, this.Context.ClientWriteIV.Length);
! this.Context.ServerWriteIV = new byte[this.IvSize];
! System.Array.Copy(ivBlock, this.IvSize, this.Context.ServerWriteIV, 0, this.Context.ServerWriteIV.Length);
! }
!
! // Clear no more needed data
! seed.Reset();
! keyBlock.Reset();
}
--- 118,127 ----
public override void CreateMasterSecret(byte[] preMasterSecret)
{
! throw new NotSupportedException();
}
public override void CreateKeys()
{
! throw new NotSupportedException();
}
|