[pgsqlclient-checkins] pgsqlclient_10/Mono.Security.Protocol.Tls/Mono.Security.Protocol.Tls SslClien
Status: Inactive
Brought to you by:
carlosga_fb
Update of /cvsroot/pgsqlclient/pgsqlclient_10/Mono.Security.Protocol.Tls/Mono.Security.Protocol.Tls
In directory sc8-pr-cvs1:/tmp/cvs-serv17476
Modified Files:
SecurityProtocolType.cs TlsCipherSuiteCollection.cs
TlsCipherSuiteFactory.cs TlsContext.cs
Added Files:
SslClientStream.cs TlsClientSettings.cs
Removed Files:
TlsNetworkStream.cs TlsSession.cs TlsSessionSettings.cs
TlsSessionState.cs TlsSocket.cs
Log Message:
2003-11-13 Carlos Guzmán Álvarez <car...@te...>
* Added implementation of an SslClientStream class similar to the MS .NET Framework 1.2 documentation.
The next files are no more needed:
- TlsSession.cs
- TlsNetworkStream.cs
- TlsSocket.cs
- TlsSessionState.cs
The next files are renamed:
- TlsSessionSettings.cs -> TlsClientSettings.cs
- TlsSessionContext.cs -> TlsContext.cs
The next files are new:
- SslClientStream.cs ( the name is non definitive yet )
The next files where changed to reflect the new canges:
- TlsHandshakeMessage.cs
- TlsClientCertificate.cs
- TlsClientCertificateVerify.cs
- TlsClientFinished.cs
- TlsClientHello.cs
- TlsClientKeyExchange.cs
- TlsServerCertificate.cs
- TlsServerCertificateRequest.cs
- TlsServerFinished.cs
- TlsServerHello.cs
- TlsServerHelloDone.cs
- TlsServerKeyExchange.cs
- TlsAlert.cs
- TlsCloseNotifyAlert.cs
--- NEW FILE: TlsClientSettings.cs ---
(This appears to be a binary file; contents omitted.)
Index: SecurityProtocolType.cs
===================================================================
RCS file: /cvsroot/pgsqlclient/pgsqlclient_10/Mono.Security.Protocol.Tls/Mono.Security.Protocol.Tls/SecurityProtocolType.cs,v
retrieving revision 1.1
retrieving revision 1.2
diff -C2 -d -r1.1 -r1.2
*** SecurityProtocolType.cs 13 Nov 2003 09:21:51 -0000 1.1
--- SecurityProtocolType.cs 14 Nov 2003 13:40:40 -0000 1.2
***************
*** 31,35 ****
Default = (0x03 << 8) | 0x01,
Ssl3 = (0x03 << 8) | 0x00,
! Tls1 = (0x03 << 8) | 0x01
}
}
--- 31,35 ----
Default = (0x03 << 8) | 0x01,
Ssl3 = (0x03 << 8) | 0x00,
! Tls = (0x03 << 8) | 0x01
}
}
Index: TlsCipherSuiteCollection.cs
===================================================================
RCS file: /cvsroot/pgsqlclient/pgsqlclient_10/Mono.Security.Protocol.Tls/Mono.Security.Protocol.Tls/TlsCipherSuiteCollection.cs,v
retrieving revision 1.5
retrieving revision 1.6
diff -C2 -d -r1.5 -r1.6
*** TlsCipherSuiteCollection.cs 13 Nov 2003 09:21:52 -0000 1.5
--- TlsCipherSuiteCollection.cs 14 Nov 2003 13:40:40 -0000 1.6
***************
*** 125,129 ****
effectiveKeyBytes, ivSize, blockSize));
! case SecurityProtocolType.Tls1:
return this.add(
new TlsCipherSuite(
--- 125,129 ----
effectiveKeyBytes, ivSize, blockSize));
! case SecurityProtocolType.Tls:
return this.add(
new TlsCipherSuite(
Index: TlsCipherSuiteFactory.cs
===================================================================
RCS file: /cvsroot/pgsqlclient/pgsqlclient_10/Mono.Security.Protocol.Tls/Mono.Security.Protocol.Tls/TlsCipherSuiteFactory.cs,v
retrieving revision 1.10
retrieving revision 1.11
diff -C2 -d -r1.10 -r1.11
*** TlsCipherSuiteFactory.cs 13 Nov 2003 09:21:52 -0000 1.10
--- TlsCipherSuiteFactory.cs 14 Nov 2003 13:40:40 -0000 1.11
***************
*** 36,40 ****
return TlsCipherSuiteFactory.GetSsl3SupportedCiphers();
! case SecurityProtocolType.Tls1:
return TlsCipherSuiteFactory.GetTls1SupportedCiphers();
--- 36,40 ----
return TlsCipherSuiteFactory.GetSsl3SupportedCiphers();
! case SecurityProtocolType.Tls:
return TlsCipherSuiteFactory.GetTls1SupportedCiphers();
***************
*** 48,56 ****
private static TlsCipherSuiteCollection GetTls1SupportedCiphers()
{
! TlsCipherSuiteCollection scs = new TlsCipherSuiteCollection(SecurityProtocolType.Tls1);
// Supported ciphers
! scs.Add((0x00 << 0x08) | 0x35, "TLS_RSA_WITH_AES_256_CBC_SHA", CipherAlgorithmType.Rijndael, HashAlgorithmType.Sha1, ExchangeAlgorithmType.RsaSign, false, true, 32, 32, 256, 16, 16);
! scs.Add((0x00 << 0x08) | 0x2F, "TLS_RSA_WITH_AES_128_CBC_SHA", CipherAlgorithmType.Rijndael, HashAlgorithmType.Sha1, ExchangeAlgorithmType.RsaSign, false, true, 16, 16, 128, 16, 16);
scs.Add((0x00 << 0x08) | 0x0A, "TLS_RSA_WITH_3DES_EDE_CBC_SHA", CipherAlgorithmType.TripleDes, HashAlgorithmType.Sha1, ExchangeAlgorithmType.RsaSign, false, true, 24, 24, 168, 8, 8);
scs.Add((0x00 << 0x08) | 0x09, "TLS_RSA_WITH_DES_CBC_SHA", CipherAlgorithmType.Des, HashAlgorithmType.Sha1, ExchangeAlgorithmType.RsaSign, false, true, 8, 8, 56, 8, 8);
--- 48,56 ----
private static TlsCipherSuiteCollection GetTls1SupportedCiphers()
{
! TlsCipherSuiteCollection scs = new TlsCipherSuiteCollection(SecurityProtocolType.Tls);
// Supported ciphers
! // scs.Add((0x00 << 0x08) | 0x35, "TLS_RSA_WITH_AES_256_CBC_SHA", CipherAlgorithmType.Rijndael, HashAlgorithmType.Sha1, ExchangeAlgorithmType.RsaSign, false, true, 32, 32, 256, 16, 16);
! // scs.Add((0x00 << 0x08) | 0x2F, "TLS_RSA_WITH_AES_128_CBC_SHA", CipherAlgorithmType.Rijndael, HashAlgorithmType.Sha1, ExchangeAlgorithmType.RsaSign, false, true, 16, 16, 128, 16, 16);
scs.Add((0x00 << 0x08) | 0x0A, "TLS_RSA_WITH_3DES_EDE_CBC_SHA", CipherAlgorithmType.TripleDes, HashAlgorithmType.Sha1, ExchangeAlgorithmType.RsaSign, false, true, 24, 24, 168, 8, 8);
scs.Add((0x00 << 0x08) | 0x09, "TLS_RSA_WITH_DES_CBC_SHA", CipherAlgorithmType.Des, HashAlgorithmType.Sha1, ExchangeAlgorithmType.RsaSign, false, true, 8, 8, 56, 8, 8);
Index: TlsContext.cs
===================================================================
RCS file: /cvsroot/pgsqlclient/pgsqlclient_10/Mono.Security.Protocol.Tls/Mono.Security.Protocol.Tls/TlsContext.cs,v
retrieving revision 1.1
retrieving revision 1.2
diff -C2 -d -r1.1 -r1.2
*** TlsContext.cs 13 Nov 2003 09:21:52 -0000 1.1
--- TlsContext.cs 14 Nov 2003 13:40:40 -0000 1.2
***************
*** 25,31 ****
--- 25,34 ----
using System;
using System.Text;
+ using System.Collections;
using System.Security.Cryptography;
+ using System.Security.Cryptography.X509Certificates;
using Mono.Security.Cryptography;
+ using Mono.Security.Protocol.Tls.Alerts;
using Mono.Security.Protocol.Tls.Handshake;
***************
*** 35,42 ****
--- 38,51 ----
{
#region FIELDS
+
+ // SslClientStream that owns the context
+ private SslClientStream sslStream;
// Protocol version
private SecurityProtocolType protocol;
+ // Sesison ID
+ private byte[] sessionId;
+
// Compression method
private SecurityCompressionType compressionMethod;
***************
*** 45,48 ****
--- 54,60 ----
private TlsServerSettings serverSettings;
+ // Client configuration
+ private TlsClientSettings clientSettings;
+
// Cipher suite information
private CipherSuite cipher;
***************
*** 87,90 ****
--- 99,107 ----
#region PROPERTIES
+ public SslClientStream SslStream
+ {
+ get { return sslStream; }
+ }
+
public SecurityProtocolType Protocol
{
***************
*** 93,96 ****
--- 110,119 ----
}
+ public byte[] SessionId
+ {
+ get { return this.sessionId; }
+ set { this.sessionId = value; }
+ }
+
public SecurityCompressionType CompressionMethod
{
***************
*** 105,108 ****
--- 128,137 ----
}
+ public TlsClientSettings ClientSettings
+ {
+ get { return this.clientSettings; }
+ set { this.clientSettings = value; }
+ }
+
public bool IsActual
{
***************
*** 228,237 ****
#region CONSTRUCTORS
! public TlsContext()
{
! this.protocol = SecurityProtocolType.Tls1;
this.compressionMethod = SecurityCompressionType.None;
this.serverSettings = new TlsServerSettings();
this.handshakeMessages = new TlsStream();
}
--- 257,277 ----
#region CONSTRUCTORS
! public TlsContext(
! SslClientStream sslStream,
! SecurityProtocolType securityProtocolType,
! string targetHost,
! X509CertificateCollection clientCertificates)
{
! this.sslStream = sslStream;
! this.protocol = securityProtocolType;
this.compressionMethod = SecurityCompressionType.None;
this.serverSettings = new TlsServerSettings();
+ this.clientSettings = new TlsClientSettings();
this.handshakeMessages = new TlsStream();
+ this.sessionId = null;
+
+ // Set client settings
+ this.ClientSettings.TargetHost = targetHost;
+ this.ClientSettings.Certificates = clientCertificates;
}
***************
*** 283,286 ****
--- 323,348 ----
this.serverWriteMAC = null;
}
+ }
+
+ #endregion
+
+ #region EXCEPTION_METHODS
+
+ internal TlsException CreateException(TlsAlertLevel alertLevel, TlsAlertDescription alertDesc)
+ {
+ return CreateException(TlsAlert.GetAlertMessage(alertDesc));
+ }
+
+ internal TlsException CreateException(string format, params object[] args)
+ {
+ StringBuilder message = new StringBuilder();
+ message.AppendFormat(format, args);
+
+ return CreateException(message.ToString());
+ }
+
+ internal TlsException CreateException(string message)
+ {
+ return new TlsException(message);
}
--- TlsNetworkStream.cs DELETED ---
--- TlsSession.cs DELETED ---
--- TlsSessionSettings.cs DELETED ---
--- TlsSessionState.cs DELETED ---
--- TlsSocket.cs DELETED ---
|