Thread: [pgsqlclient-checkins] pgsqlclient_10/Mono.Security/Mono.Security/Mono.Security.Protocol.Tls.Handsha
Status: Inactive
Brought to you by:
carlosga_fb
From: <car...@us...> - 2004-03-03 16:30:07
|
Update of /cvsroot/pgsqlclient/pgsqlclient_10/Mono.Security/Mono.Security/Mono.Security.Protocol.Tls.Handshake In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv18545 Added Files: ClientCertificateType.cs HandshakeMessage.cs HandshakeType.cs Removed Files: TlsClientCertificateType.cs TlsHandshakeMessage.cs TlsHandshakeType.cs Log Message: 2004-03-03 Carlos Guzman Alvarez <car...@te...> * Mono.Security.Protocol.Tls/SslServerStream.cs: - Implemented flow for the server handshake. * Mono.Security.Protocol.Tls/Ciphersuite.cs: * Mono.Security.Protocol.Tls/TlsCiphersuite.cs: * Mono.Security.Protocol.Tls/ClientRecordProtocol.cs: * Mono.Security.Protocol.Tls/ServerRecordProtocol.cs: * Mono.Security.Protocol.Tls/SslClientStream.cs: * Mono.Security.Protocol.Tls/TlsServerSettings.cs: * Mono.Security.Protocol.Tls/TlsClientSettings.cs: * Mono.Security.Protocol.Tls/ClientContext.cs: * Mono.Security.Protocol.Tls.Handshake.Client/*.cs: * Mono.Security.Protocol.Tls.Handshake.Server/*.cs: - Changes for make use of the renamed classes and enums. * Mono.Security.Protocol.Tls.Handshake/TlsHandshakeType.cs: - Renamed to HandshakeType.cs (Enum and file) * Mono.Security.Protocol.Tls.Handshake/TlsHandshakeMessage.cs: - Renamed to HandshakeMessage.cs (Class and file) * Mono.Security.Protocol.Tls.Handshake/TlsClientCertificateType.cs: - Renamed to ClientCertificateType.cs (Enum and file) * Mono.Security.Protocol.Tls.Alerts/TlsAlert.cs: - Renamed to Alert (Class, enums and file) * Mono.Security.Protocol.Tls/TlsContentType.cs: - Renamed to ContentType.cs ( Enum and file ) * Mono.Security.Protocol.Tls/TlsCiphersuiteCollection.cs: - Renamed to CiphersuiteCollection.cs ( Class and file ) * Mono.Security.Protocol.Tls/TlsCiphersuiteFactory.cs: - Renamed to CiphersuiteCollection.cs ( Class and file ) * Mono.Security.Protocol.Tls/TlsSslHandshakeHash.cs: - Renamed to SslHandshakeHash.cs ( Class and file ) * Mono.Security.Protocol.Tls/TlsSslCipherSuite.cs: - Renamed to SslCipherSuite.cs ( Class and file ) --- NEW FILE: ClientCertificateType.cs --- /* Transport Security Layer (TLS) * Copyright (c) 2003-2004 Carlos Guzman Alvarez * * Permission is hereby granted, free of charge, to any person * obtaining a copy of this software and associated documentation * files (the "Software"), to deal in the Software without restriction, * including without limitation the rights to use, copy, modify, merge, * publish, distribute, sublicense, and/or sell copies of the Software, * and to permit persons to whom the Software is furnished to do so, * subject to the following conditions: * * The above copyright notice and this permission notice shall be included * in all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT * HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER * DEALINGS IN THE SOFTWARE. */ using System; namespace Mono.Security.Protocol.Tls.Handshake { [Serializable] internal enum ClientCertificateType { RSA = 1, DSS = 2, RSAFixed = 3, DSSFixed = 4, Unknown = 255 } } --- NEW FILE: HandshakeMessage.cs --- /* Transport Security Layer (TLS) * Copyright (c) 2003-2004 Carlos Guzman Alvarez * * Permission is hereby granted, free of charge, to any person * obtaining a copy of this software and associated documentation * files (the "Software"), to deal in the Software without restriction, * including without limitation the rights to use, copy, modify, merge, * publish, distribute, sublicense, and/or sell copies of the Software, * and to permit persons to whom the Software is furnished to do so, * subject to the following conditions: * * The above copyright notice and this permission notice shall be included * in all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT * HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER * DEALINGS IN THE SOFTWARE. */ using System; namespace Mono.Security.Protocol.Tls.Handshake { internal abstract class HandshakeMessage : TlsStream { #region Fields private Context context; private HandshakeType handshakeType; private ContentType contentType; #endregion #region Properties public Context Context { get { return this.context; } } public HandshakeType HandshakeType { get { return this.handshakeType; } } public ContentType ContentType { get { return this.contentType; } } #endregion #region Constructors public HandshakeMessage( Context context, HandshakeType handshakeType) : this(context, handshakeType, ContentType.Handshake) { } public HandshakeMessage( Context context, HandshakeType handshakeType, ContentType contentType) : base() { this.context = context; this.handshakeType = handshakeType; this.contentType = contentType; // Process message this.process(); } public HandshakeMessage( Context context, HandshakeType handshakeType, byte[] data) : base(data) { this.context = context; this.handshakeType = handshakeType; // Process message this.process(); } #endregion #region Abstract Methods protected abstract void ProcessAsTls1(); protected abstract void ProcessAsSsl3(); #endregion #region Methods private void process() { switch (this.Context.SecurityProtocol) { case SecurityProtocolType.Tls: case SecurityProtocolType.Default: this.ProcessAsTls1(); break; case SecurityProtocolType.Ssl3: this.ProcessAsSsl3(); break; case SecurityProtocolType.Ssl2: default: throw new NotSupportedException("Unsupported security protocol type"); } } public virtual void Update() { this.context.LastHandshakeMsg = this.handshakeType; if (this.CanWrite) { this.context.HandshakeMessages.Write(this.EncodeMessage()); this.Reset(); } } public virtual byte[] EncodeMessage() { byte[] result = null; if (CanWrite) { TlsStream c = new TlsStream(); c.Write((byte)HandshakeType); c.WriteInt24((int)this.Length); c.Write(this.ToArray()); result = c.ToArray(); } return result; } #endregion } } --- NEW FILE: HandshakeType.cs --- /* Transport Security Layer (TLS) * Copyright (c) 2003-2004 Carlos Guzman Alvarez * * Permission is hereby granted, free of charge, to any person * obtaining a copy of this software and associated documentation * files (the "Software"), to deal in the Software without restriction, * including without limitation the rights to use, copy, modify, merge, * publish, distribute, sublicense, and/or sell copies of the Software, * and to permit persons to whom the Software is furnished to do so, * subject to the following conditions: * * The above copyright notice and this permission notice shall be included * in all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT * HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER * DEALINGS IN THE SOFTWARE. */ using System; namespace Mono.Security.Protocol.Tls.Handshake { [Serializable] internal enum HandshakeType : byte { HelloRequest = 0, ClientHello = 1, ServerHello = 2, Certificate = 11, ServerKeyExchange = 12, CertificateRequest = 13, ServerHelloDone = 14, CertificateVerify = 15, ClientKeyExchange = 16, Finished = 20, } } --- TlsClientCertificateType.cs DELETED --- --- TlsHandshakeMessage.cs DELETED --- --- TlsHandshakeType.cs DELETED --- |