Thread: [pgsqlclient-checkins] pgsqlclient_10/Mono.Security.Protocol.Tls/Mono.Security.Protocol.Tls CipherSu
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-serv14073 Modified Files: CipherSuite.cs SslClientStream.cs SslServerStream.cs TlsCipherSuite.cs TlsCipherSuiteCollection.cs TlsCipherSuiteFactory.cs TlsClientSettings.cs TlsContext.cs TlsException.cs TlsServerSettings.cs TlsSslCipherSuite.cs TlsSslHandshakeHash.cs TlsStream.cs Log Message: 2003-12-15 Carlos Guzmán Álvarez <car...@te...> * Changed #region names in all source files. Index: CipherSuite.cs =================================================================== RCS file: /cvsroot/pgsqlclient/pgsqlclient_10/Mono.Security.Protocol.Tls/Mono.Security.Protocol.Tls/CipherSuite.cs,v retrieving revision 1.10 retrieving revision 1.11 diff -C2 -d -r1.10 -r1.11 *** CipherSuite.cs 22 Nov 2003 14:43:51 -0000 1.10 --- CipherSuite.cs 14 Dec 2003 14:59:39 -0000 1.11 *************** *** 1,547 **** ! /* Transport Security Layer (TLS) ! * Copyright (c) 2003 Carlos Guzmán Álvarez ! * ! * 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: [...1054 lines suppressed...] ! this.decryptionAlgorithm.KeySize = this.keyMaterialSize * 8; ! this.decryptionAlgorithm.BlockSize = this.blockSize * 8; ! } ! ! // Set the key and IV for the algorithm ! this.decryptionAlgorithm.Key = this.context.ServerWriteKey; ! this.decryptionAlgorithm.IV = this.context.ServerWriteIV; ! ! // Create decryption cipher ! this.decryptionCipher = this.decryptionAlgorithm.CreateDecryptor(); ! ! // Create the HMAC algorithm for the server ! this.serverHMAC = new M.HMAC( ! this.HashAlgorithmName, ! this.context.ServerWriteMAC); ! } ! ! #endregion ! } } Index: SslClientStream.cs =================================================================== RCS file: /cvsroot/pgsqlclient/pgsqlclient_10/Mono.Security.Protocol.Tls/Mono.Security.Protocol.Tls/SslClientStream.cs,v retrieving revision 1.9 retrieving revision 1.10 diff -C2 -d -r1.9 -r1.10 *** SslClientStream.cs 9 Dec 2003 19:19:04 -0000 1.9 --- SslClientStream.cs 14 Dec 2003 14:59:39 -0000 1.10 *************** *** 1,1108 **** ! /* Transport Security Layer (TLS) ! * Copyright (c) 2003 Carlos Guzmán Álvarez ! * ! * 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: [...2187 lines suppressed...] ! X509CertificateCollection clientCertificates, ! X509Certificate serverCertificate, ! string targetHost, ! X509CertificateCollection serverRequestedCertificates) ! { ! if (this.ClientCertSelection != null) ! { ! return this.ClientCertSelection( ! clientCertificates, ! serverCertificate, ! targetHost, ! serverRequestedCertificates); ! } ! ! return null; ! } ! ! #endregion ! } ! } Index: SslServerStream.cs =================================================================== RCS file: /cvsroot/pgsqlclient/pgsqlclient_10/Mono.Security.Protocol.Tls/Mono.Security.Protocol.Tls/SslServerStream.cs,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** SslServerStream.cs 23 Nov 2003 12:50:08 -0000 1.1 --- SslServerStream.cs 14 Dec 2003 14:59:39 -0000 1.2 *************** *** 1,281 **** ! /* Transport Security Layer (TLS) ! * Copyright (c) 2003 Carlos Guzmán Álvarez ! * ! * 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; ! using System.IO; ! using System.Security.Cryptography.X509Certificates; ! ! namespace Mono.Security.Protocol.Tls ! { ! public class SslServerStream : Stream, IDisposable ! { ! #region FIELDS ! ! private Stream innerStream; ! private bool disposed; ! private bool ownsStream; ! ! #endregion ! ! #region PROPERTIES ! ! public override bool CanRead ! { ! get { return this.innerStream.CanRead; } ! } ! ! public override bool CanWrite ! { ! get { return this.innerStream.CanWrite; } ! } ! ! public override bool CanSeek ! { ! get { return this.innerStream.CanSeek; } ! } ! ! public override long Length ! { ! get { throw new NotSupportedException(); } ! } ! ! public override long Position ! { ! get { throw new NotSupportedException(); } ! set { throw new NotSupportedException(); } ! } ! ! #endregion ! ! #region SECURITY_PROPERTIES ! ! public bool CheckCertRevocationStatus ! { ! get { throw new NotSupportedException(); } ! set { throw new NotSupportedException(); } ! } ! ! public CipherAlgorithmType CipherAlgorithm ! { ! get { throw new NotSupportedException(); } ! } ! ! public int CipherStrength ! { ! get { throw new NotSupportedException(); } ! } ! ! public X509Certificate ClientCertificate ! { ! get { throw new NotSupportedException(); } ! } ! ! public CertificateValidationCallback ClientCertValidationDelegate ! { ! get { throw new NotSupportedException(); } ! set { throw new NotSupportedException(); } ! } ! ! public HashAlgorithmType HashAlgorithm ! { ! get { throw new NotSupportedException(); } ! } ! ! public int HashStrength ! { ! get { throw new NotSupportedException(); } ! } ! ! public int KeyExchangeStrength ! { ! get { throw new NotSupportedException(); } ! } ! ! public ExchangeAlgorithmType KeyExchangeAlgorithm ! { ! get { throw new NotSupportedException(); } ! } ! ! public SecurityProtocolType SecurityProtocol ! { ! get { throw new NotSupportedException(); } ! } ! ! public X509Certificate ServerCertificate ! { ! get { throw new NotSupportedException(); } ! } ! ! #endregion ! ! #region CONSTRUCTORS ! ! public SslServerStream(Stream stream, X509Certificate serverCertificate) ! { ! } ! ! public SslServerStream( ! Stream stream, ! X509Certificate serverCertificate, ! bool clientCertificateRequired, ! bool ownsStream) ! { ! } ! ! public SslServerStream( ! Stream stream, ! X509Certificate serverCertificate, ! bool clientCertificateRequired, ! bool ownsStream, ! SecurityProtocolType securityProtocolType) ! { ! } ! ! #endregion ! ! #region DESTRUCTOR ! ! ~SslServerStream() ! { ! this.Dispose(false); ! } ! ! #endregion ! ! #region IDISPOSABLE ! ! void IDisposable.Dispose() ! { ! this.Dispose(true); ! GC.SuppressFinalize(this); ! } ! ! protected virtual void Dispose(bool disposing) ! { ! if (!this.disposed) ! { ! if (disposing) ! { ! if (this.innerStream != null) ! { ! if (this.ownsStream) ! { ! // Close inner stream ! this.innerStream.Close(); ! } ! } ! this.ownsStream = false; ! this.innerStream = null; ! } ! ! this.disposed = true; ! } ! } ! ! #endregion ! ! #region METHODS ! ! public override IAsyncResult BeginRead( ! byte[] buffer, ! int offset, ! int count, ! AsyncCallback asyncCallback, ! object asyncState) ! { ! throw new NotSupportedException(); ! } ! ! public override IAsyncResult BeginWrite( ! byte[] buffer, ! int offset, ! int count, ! AsyncCallback asyncCallback, ! object asyncState) ! { ! throw new NotSupportedException(); ! } ! ! public override void Close() ! { ! throw new NotSupportedException(); ! } ! ! public override int EndRead(IAsyncResult asyncResult) ! { ! throw new NotSupportedException(); ! } ! ! public override void EndWrite(IAsyncResult asyncResult) ! { ! throw new NotSupportedException(); ! } ! ! public override void Flush() ! { ! if (this.disposed) ! { ! throw new ObjectDisposedException("The NetworkStream is closed."); ! } ! } ! ! public int Read(byte[] buffer) ! { ! throw new NotSupportedException(); ! } ! ! public override int Read( ! byte[] buffer, ! int offset, ! int count) ! { ! throw new NotSupportedException(); ! } ! ! public override long Seek(long offset, SeekOrigin origin) ! { ! throw new NotSupportedException(); ! } ! ! public override void SetLength(long value) ! { ! throw new NotSupportedException(); ! } ! ! public void Write(byte[] buffer) ! { ! throw new NotSupportedException(); ! } ! ! public override void Write( ! byte[] buffer, ! int offset, ! int count) ! { ! throw new NotSupportedException(); ! } ! ! #endregion ! } ! } --- 1,281 ---- ! /* Transport Security Layer (TLS) ! * Copyright (c) 2003 Carlos Guzmán Álvarez ! * ! * 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; ! using System.IO; ! using System.Security.Cryptography.X509Certificates; ! ! namespace Mono.Security.Protocol.Tls ! { ! public class SslServerStream : Stream, IDisposable ! { ! #region Fields ! ! private Stream innerStream; ! private bool disposed; ! private bool ownsStream; ! ! #endregion ! ! #region Properties ! ! public override bool CanRead ! { ! get { return this.innerStream.CanRead; } ! } ! ! public override bool CanWrite ! { ! get { return this.innerStream.CanWrite; } ! } ! ! public override bool CanSeek ! { ! get { return this.innerStream.CanSeek; } ! } ! ! public override long Length ! { ! get { throw new NotSupportedException(); } ! } ! ! public override long Position ! { ! get { throw new NotSupportedException(); } ! set { throw new NotSupportedException(); } ! } ! ! #endregion ! ! #region Security Properties ! ! public bool CheckCertRevocationStatus ! { ! get { throw new NotSupportedException(); } ! set { throw new NotSupportedException(); } ! } ! ! public CipherAlgorithmType CipherAlgorithm ! { ! get { throw new NotSupportedException(); } ! } ! ! public int CipherStrength ! { ! get { throw new NotSupportedException(); } ! } ! ! public X509Certificate ClientCertificate ! { ! get { throw new NotSupportedException(); } ! } ! ! public CertificateValidationCallback ClientCertValidationDelegate ! { ! get { throw new NotSupportedException(); } ! set { throw new NotSupportedException(); } ! } ! ! public HashAlgorithmType HashAlgorithm ! { ! get { throw new NotSupportedException(); } ! } ! ! public int HashStrength ! { ! get { throw new NotSupportedException(); } ! } ! ! public int KeyExchangeStrength ! { ! get { throw new NotSupportedException(); } ! } ! ! public ExchangeAlgorithmType KeyExchangeAlgorithm ! { ! get { throw new NotSupportedException(); } ! } ! ! public SecurityProtocolType SecurityProtocol ! { ! get { throw new NotSupportedException(); } ! } ! ! public X509Certificate ServerCertificate ! { ! get { throw new NotSupportedException(); } ! } ! ! #endregion ! ! #region Constructors ! ! public SslServerStream(Stream stream, X509Certificate serverCertificate) ! { ! } ! ! public SslServerStream( ! Stream stream, ! X509Certificate serverCertificate, ! bool clientCertificateRequired, ! bool ownsStream) ! { ! } ! ! public SslServerStream( ! Stream stream, ! X509Certificate serverCertificate, ! bool clientCertificateRequired, ! bool ownsStream, ! SecurityProtocolType securityProtocolType) ! { ! } ! ! #endregion ! ! #region Finalizer ! ! ~SslServerStream() ! { ! this.Dispose(false); ! } ! ! #endregion ! ! #region IDisposable Methods ! ! void IDisposable.Dispose() ! { ! this.Dispose(true); ! GC.SuppressFinalize(this); ! } ! ! protected virtual void Dispose(bool disposing) ! { ! if (!this.disposed) ! { ! if (disposing) ! { ! if (this.innerStream != null) ! { ! if (this.ownsStream) ! { ! // Close inner stream ! this.innerStream.Close(); ! } ! } ! this.ownsStream = false; ! this.innerStream = null; ! } ! ! this.disposed = true; ! } ! } ! ! #endregion ! ! #region Methods ! ! public override IAsyncResult BeginRead( ! byte[] buffer, ! int offset, ! int count, ! AsyncCallback asyncCallback, ! object asyncState) ! { ! throw new NotSupportedException(); ! } ! ! public override IAsyncResult BeginWrite( ! byte[] buffer, ! int offset, ! int count, ! AsyncCallback asyncCallback, ! object asyncState) ! { ! throw new NotSupportedException(); ! } ! ! public override void Close() ! { ! throw new NotSupportedException(); ! } ! ! public override int EndRead(IAsyncResult asyncResult) ! { ! throw new NotSupportedException(); ! } ! ! public override void EndWrite(IAsyncResult asyncResult) ! { ! throw new NotSupportedException(); ! } ! ! public override void Flush() ! { ! if (this.disposed) ! { ! throw new ObjectDisposedException("The NetworkStream is closed."); ! } ! } ! ! public int Read(byte[] buffer) ! { ! throw new NotSupportedException(); ! } ! ! public override int Read( ! byte[] buffer, ! int offset, ! int count) ! { ! throw new NotSupportedException(); ! } ! ! public override long Seek(long offset, SeekOrigin origin) ! { ! throw new NotSupportedException(); ! } ! ! public override void SetLength(long value) ! { ! throw new NotSupportedException(); ! } ! ! public void Write(byte[] buffer) ! { ! throw new NotSupportedException(); ! } ! ! public override void Write( ! byte[] buffer, ! int offset, ! int count) ! { ! throw new NotSupportedException(); ! } ! ! #endregion ! } ! } Index: TlsCipherSuite.cs =================================================================== RCS file: /cvsroot/pgsqlclient/pgsqlclient_10/Mono.Security.Protocol.Tls/Mono.Security.Protocol.Tls/TlsCipherSuite.cs,v retrieving revision 1.9 retrieving revision 1.10 diff -C2 -d -r1.9 -r1.10 *** TlsCipherSuite.cs 13 Nov 2003 09:21:52 -0000 1.9 --- TlsCipherSuite.cs 14 Dec 2003 14:59:39 -0000 1.10 *************** *** 1,158 **** ! /* Transport Security Layer (TLS) ! * Copyright (c) 2003 Carlos Guzmán Álvarez ! * ! * 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; ! using System.IO; ! using System.Text; ! using System.Security.Cryptography; ! using System.Security.Cryptography.X509Certificates; ! ! using Mono.Security; ! using Mono.Security.Cryptography; ! ! namespace Mono.Security.Protocol.Tls ! { ! internal class TlsCipherSuite : CipherSuite ! { ! #region CONSTRUCTORS ! ! public TlsCipherSuite( ! short code, string name, CipherAlgorithmType cipherAlgorithmType, ! HashAlgorithmType hashAlgorithmType, ExchangeAlgorithmType exchangeAlgorithmType, ! bool exportable, bool blockMode, byte keyMaterialSize, ! byte expandedKeyMaterialSize, short effectiveKeyBytes, ! byte ivSize, byte blockSize) : ! base(code, name, cipherAlgorithmType, hashAlgorithmType, ! exchangeAlgorithmType, exportable, blockMode, keyMaterialSize, ! expandedKeyMaterialSize, effectiveKeyBytes, ivSize, blockSize) ! { ! } ! ! #endregion ! ! #region MAC_GENERATION_METHOD ! ! public override byte[] ComputeServerRecordMAC(TlsContentType contentType, byte[] fragment) ! { ! TlsStream data = new TlsStream(); ! byte[] result = null; ! ! data.Write(this.Context.ReadSequenceNumber); ! data.Write((byte)contentType); ! data.Write((short)this.Context.Protocol); ! data.Write((short)fragment.Length); ! data.Write(fragment); ! ! result = this.ServerHMAC.ComputeHash(data.ToArray()); ! ! data.Reset(); ! ! return result; ! } ! ! public override byte[] ComputeClientRecordMAC(TlsContentType contentType, byte[] fragment) ! { ! TlsStream data = new TlsStream(); ! byte[] result = null; ! ! data.Write(this.Context.WriteSequenceNumber); ! data.Write((byte)contentType); ! data.Write((short)this.Context.Protocol); ! data.Write((short)fragment.Length); ! data.Write(fragment); ! ! result = this.ClientHMAC.ComputeHash(data.ToArray()); ! ! data.Reset(); ! ! return result; ! } ! ! #endregion ! ! #region KEY_GENERATION_METODS ! ! public override void ComputeMasterSecret(byte[] preMasterSecret) ! { ! // Create master secret ! this.Context.MasterSecret = new byte[preMasterSecret.Length]; ! this.Context.MasterSecret = this.PRF( ! preMasterSecret, "master secret", this.Context.RandomCS, 48); ! } ! ! public override void ComputeKeys() ! { ! // Create keyblock ! TlsStream keyBlock = new TlsStream( ! this.PRF( ! this.Context.MasterSecret, ! "key expansion", ! this.Context.RandomSC, ! 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 ! { ! // Generate final write keys ! byte[] finalClientWriteKey = PRF(this.Context.ClientWriteKey, "client write key", this.Context.RandomCS, this.KeyMaterialSize); ! byte[] finalServerWriteKey = PRF(this.Context.ServerWriteKey, "server write key", this.Context.RandomCS, this.KeyMaterialSize); ! ! this.Context.ClientWriteKey = finalClientWriteKey; ! this.Context.ServerWriteKey = finalServerWriteKey; ! ! // Generate IV block ! byte[] ivBlock = PRF(new byte[]{}, "IV block", this.Context.RandomCS, 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 ! keyBlock.Reset(); ! } ! ! #endregion ! } } --- 1,158 ---- ! /* Transport Security Layer (TLS) ! * Copyright (c) 2003 Carlos Guzmán Álvarez ! * ! * 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; ! using System.IO; ! using System.Text; ! using System.Security.Cryptography; ! using System.Security.Cryptography.X509Certificates; ! ! using Mono.Security; ! using Mono.Security.Cryptography; ! ! namespace Mono.Security.Protocol.Tls ! { ! internal class TlsCipherSuite : CipherSuite ! { ! #region Constructors ! ! public TlsCipherSuite( ! short code, string name, CipherAlgorithmType cipherAlgorithmType, ! HashAlgorithmType hashAlgorithmType, ExchangeAlgorithmType exchangeAlgorithmType, ! bool exportable, bool blockMode, byte keyMaterialSize, ! byte expandedKeyMaterialSize, short effectiveKeyBytes, ! byte ivSize, byte blockSize) : ! base(code, name, cipherAlgorithmType, hashAlgorithmType, ! exchangeAlgorithmType, exportable, blockMode, keyMaterialSize, ! expandedKeyMaterialSize, effectiveKeyBytes, ivSize, blockSize) ! { ! } ! ! #endregion ! ! #region MAC Generation Methods ! ! public override byte[] ComputeServerRecordMAC(TlsContentType contentType, byte[] fragment) ! { ! TlsStream data = new TlsStream(); ! byte[] result = null; ! ! data.Write(this.Context.ReadSequenceNumber); ! data.Write((byte)contentType); ! data.Write((short)this.Context.Protocol); ! data.Write((short)fragment.Length); ! data.Write(fragment); ! ! result = this.ServerHMAC.ComputeHash(data.ToArray()); ! ! data.Reset(); ! ! return result; ! } ! ! public override byte[] ComputeClientRecordMAC(TlsContentType contentType, byte[] fragment) ! { ! TlsStream data = new TlsStream(); ! byte[] result = null; ! ! data.Write(this.Context.WriteSequenceNumber); ! data.Write((byte)contentType); ! data.Write((short)this.Context.Protocol); ! data.Write((short)fragment.Length); ! data.Write(fragment); ! ! result = this.ClientHMAC.ComputeHash(data.ToArray()); ! ! data.Reset(); ! ! return result; ! } ! ! #endregion ! ! #region Key Generation Methods ! ! public override void ComputeMasterSecret(byte[] preMasterSecret) ! { ! // Create master secret ! this.Context.MasterSecret = new byte[preMasterSecret.Length]; ! this.Context.MasterSecret = this.PRF( ! preMasterSecret, "master secret", this.Context.RandomCS, 48); ! } ! ! public override void ComputeKeys() ! { ! // Create keyblock ! TlsStream keyBlock = new TlsStream( ! this.PRF( ! this.Context.MasterSecret, ! "key expansion", ! this.Context.RandomSC, ! 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 ! { ! // Generate final write keys ! byte[] finalClientWriteKey = PRF(this.Context.ClientWriteKey, "client write key", this.Context.RandomCS, this.KeyMaterialSize); ! byte[] finalServerWriteKey = PRF(this.Context.ServerWriteKey, "server write key", this.Context.RandomCS, this.KeyMaterialSize); ! ! this.Context.ClientWriteKey = finalClientWriteKey; ! this.Context.ServerWriteKey = finalServerWriteKey; ! ! // Generate IV block ! byte[] ivBlock = PRF(new byte[]{}, "IV block", this.Context.RandomCS, 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 ! keyBlock.Reset(); ! } ! ! #endregion ! } } Index: TlsCipherSuiteCollection.cs =================================================================== RCS file: /cvsroot/pgsqlclient/pgsqlclient_10/Mono.Security.Protocol.Tls/Mono.Security.Protocol.Tls/TlsCipherSuiteCollection.cs,v retrieving revision 1.6 retrieving revision 1.7 diff -C2 -d -r1.6 -r1.7 *** TlsCipherSuiteCollection.cs 14 Nov 2003 13:40:40 -0000 1.6 --- TlsCipherSuiteCollection.cs 14 Dec 2003 14:59:39 -0000 1.7 *************** *** 1,167 **** ! /* Transport Security Layer (TLS) ! * Copyright (c) 2003 Carlos Guzmán Álvarez ! * ! * 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; ! using System.Collections; ! using System.Globalization; ! using System.Security.Cryptography; ! ! namespace Mono.Security.Protocol.Tls ! { ! internal sealed class TlsCipherSuiteCollection : ArrayList ! { ! #region FIELDS ! ! private SecurityProtocolType protocol; ! ! #endregion ! ! #region PROPERTIES ! ! public CipherSuite this[string name] ! { ! get { return (CipherSuite)this[IndexOf(name)]; } ! set { this[IndexOf(name)] = (CipherSuite)value; } ! } ! ! public CipherSuite this[short code] ! { ! get { return (CipherSuite)base[IndexOf(code)]; } ! set { base[IndexOf(code)] = (CipherSuite)value; } ! } ! ! public new CipherSuite this[int code] ! { ! get { return (CipherSuite)base[code]; } ! set { base[code] = (CipherSuite)value; } ! } ! ! #endregion ! ! #region CONSTRUCTORS ! ! public TlsCipherSuiteCollection(SecurityProtocolType protocol) : base() ! { ! this.protocol = protocol; ! } ! ! #endregion ! ! #region METHODS ! ! public bool Contains(string name) ! { ! return(-1 != IndexOf(name)); ! } ! ! public int IndexOf(string name) ! { ! int index = 0; ! foreach (CipherSuite suite in this) ! { ! if (cultureAwareCompare(suite.Name, name)) ! { ! return index; ! } ! index++; ! } ! return -1; ! } ! ! public int IndexOf(short code) ! { ! int index = 0; ! foreach (CipherSuite suite in this) ! { ! if (suite.Code == code) ! { ! return index; ! } ! index++; ! } ! return -1; ! } ! ! public void RemoveAt(string errorMessage) ! { ! RemoveAt(IndexOf(errorMessage)); ! } ! ! public CipherSuite Add( ! short code, string name, CipherAlgorithmType cipherType, ! HashAlgorithmType hashType, ExchangeAlgorithmType exchangeType, ! bool exportable, bool blockMode, byte keyMaterialSize, ! byte expandedKeyMaterialSize, short effectiveKeyBytes, ! byte ivSize, byte blockSize) ! { ! switch (this.protocol) ! { ! case SecurityProtocolType.Ssl3: ! return this.add( ! new TlsSslCipherSuite( ! code, name, cipherType, hashType, exchangeType, exportable, ! blockMode, keyMaterialSize, expandedKeyMaterialSize, ! effectiveKeyBytes, ivSize, blockSize)); ! ! case SecurityProtocolType.Tls: ! return this.add( ! new TlsCipherSuite( ! code, name, cipherType, hashType, exchangeType, exportable, ! blockMode, keyMaterialSize, expandedKeyMaterialSize, ! effectiveKeyBytes, ivSize, blockSize)); ! ! default: ! throw new NotSupportedException(); ! } ! } ! ! private TlsCipherSuite add(TlsCipherSuite cipherSuite) ! { ! base.Add(cipherSuite); ! ! return cipherSuite; ! } ! ! private TlsSslCipherSuite add(TlsSslCipherSuite cipherSuite) ! { ! base.Add(cipherSuite); ! ! return cipherSuite; ! } ! ! private bool cultureAwareCompare(string strA, string strB) ! { ! try ! { ! return CultureInfo.CurrentCulture.CompareInfo.Compare(strA, strB, CompareOptions.IgnoreKanaType | CompareOptions.IgnoreWidth | CompareOptions.IgnoreCase) == 0 ? true : false; ! } ! catch (NotSupportedException) ! { ! return strA.ToUpper() == strB.ToUpper() ? true : false; ! } ! } ! ! #endregion ! } ! } --- 1,167 ---- ! /* Transport Security Layer (TLS) ! * Copyright (c) 2003 Carlos Guzmán Álvarez ! * ! * 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; ! using System.Collections; ! using System.Globalization; ! using System.Security.Cryptography; ! ! namespace Mono.Security.Protocol.Tls ! { ! internal sealed class TlsCipherSuiteCollection : ArrayList ! { ! #region Fields ! ! private SecurityProtocolType protocol; ! ! #endregion ! ! #region Properties ! ! public CipherSuite this[string name] ! { ! get { return (CipherSuite)this[IndexOf(name)]; } ! set { this[IndexOf(name)] = (CipherSuite)value; } ! } ! ! public CipherSuite this[short code] ! { ! get { return (CipherSuite)base[IndexOf(code)]; } ! set { base[IndexOf(code)] = (CipherSuite)value; } ! } ! ! public new CipherSuite this[int code] ! { ! get { return (CipherSuite)base[code]; } ! set { base[code] = (CipherSuite)value; } ! } ! ! #endregion ! ! #region Constructors ! ! public TlsCipherSuiteCollection(SecurityProtocolType protocol) : base() ! { ! this.protocol = protocol; ! } ! ! #endregion ! ! #region Methods ! ! public bool Contains(string name) ! { ! return(-1 != IndexOf(name)); ! } ! ! public int IndexOf(string name) ! { ! int index = 0; ! foreach (CipherSuite suite in this) ! { ! if (cultureAwareCompare(suite.Name, name)) ! { ! return index; ! } ! index++; ! } ! return -1; ! } ! ! public int IndexOf(short code) ! { ! int index = 0; ! foreach (CipherSuite suite in this) ! { ! if (suite.Code == code) ! { ! return index; ! } ! index++; ! } ! return -1; ! } ! ! public void RemoveAt(string errorMessage) ! { ! RemoveAt(IndexOf(errorMessage)); ! } ! ! public CipherSuite Add( ! short code, string name, CipherAlgorithmType cipherType, ! HashAlgorithmType hashType, ExchangeAlgorithmType exchangeType, ! bool exportable, bool blockMode, byte keyMaterialSize, ! byte expandedKeyMaterialSize, short effectiveKeyBytes, ! byte ivSize, byte blockSize) ! { ! switch (this.protocol) ! { ! case SecurityProtocolType.Ssl3: ! return this.add( ! new TlsSslCipherSuite( ! code, name, cipherType, hashType, exchangeType, exportable, ! blockMode, keyMaterialSize, expandedKeyMaterialSize, ! effectiveKeyBytes, ivSize, blockSize)); ! ! case SecurityProtocolType.Tls: ! return this.add( ! new TlsCipherSuite( ! code, name, cipherType, hashType, exchangeType, exportable, ! blockMode, keyMaterialSize, expandedKeyMaterialSize, ! effectiveKeyBytes, ivSize, blockSize)); ! ! default: ! throw new NotSupportedException(); ! } ! } ! ! private TlsCipherSuite add(TlsCipherSuite cipherSuite) ! { ! base.Add(cipherSuite); ! ! return cipherSuite; ! } ! ! private TlsSslCipherSuite add(TlsSslCipherSuite cipherSuite) ! { ! base.Add(cipherSuite); ! ! return cipherSuite; ! } ! ! private bool cultureAwareCompare(string strA, string strB) ! { ! try ! { ! return CultureInfo.CurrentCulture.CompareInfo.Compare(strA, strB, CompareOptions.IgnoreKanaType | CompareOptions.IgnoreWidth | CompareOptions.IgnoreCase) == 0 ? true : false; ! } ! catch (NotSupportedException) ! { ! return strA.ToUpper() == strB.ToUpper() ? true : false; ! } ! } ! ! #endregion ! } ! } Index: TlsCipherSuiteFactory.cs =================================================================== RCS file: /cvsroot/pgsqlclient/pgsqlclient_10/Mono.Security.Protocol.Tls/Mono.Security.Protocol.Tls/TlsCipherSuiteFactory.cs,v retrieving revision 1.12 retrieving revision 1.13 diff -C2 -d -r1.12 -r1.13 *** TlsCipherSuiteFactory.cs 22 Nov 2003 14:43:51 -0000 1.12 --- TlsCipherSuiteFactory.cs 14 Dec 2003 14:59:39 -0000 1.13 *************** *** 1,168 **** ! /* Transport Security Layer (TLS) ! * Copyright (c) 2003 Carlos Guzmán Álvarez ! * ! * 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 ! { ! internal class TlsCipherSuiteFactory ! { ! public static TlsCipherSuiteCollection GetSupportedCiphers(SecurityProtocolType protocol) ! { ! switch (protocol) ! { ! case SecurityProtocolType.Ssl3: ! return TlsCipherSuiteFactory.GetSsl3SupportedCiphers(); ! ! case SecurityProtocolType.Tls: ! return TlsCipherSuiteFactory.GetTls1SupportedCiphers(); ! ! default: ! throw new NotSupportedException(); ! } ! } ! ! #region PRIVATE_STATIC_METHODS ! ! 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); ! scs.Add((0x00 << 0x08) | 0x05, "TLS_RSA_WITH_RC4_128_SHA", CipherAlgorithmType.Rc4, HashAlgorithmType.Sha1, ExchangeAlgorithmType.RsaSign, false, false, 16, 16, 128, 0, 0); ! scs.Add((0x00 << 0x08) | 0x04, "TLS_RSA_WITH_RC4_128_MD5", CipherAlgorithmType.Rc4, HashAlgorithmType.Md5, ExchangeAlgorithmType.RsaSign, false, false, 16, 16, 128, 0, 0); ! ! // Default CipherSuite ! // scs.Add(0, "TLS_NULL_WITH_NULL_NULL", CipherAlgorithmType.None, HashAlgorithmType.None, ExchangeAlgorithmType.None, true, false, 0, 0, 0, 0, 0); ! ! // RSA Cipher Suites ! // scs.Add((0x00 << 0x08) | 0x01, "TLS_RSA_WITH_NULL_MD5", CipherAlgorithmType.None, HashAlgorithmType.Md5, ExchangeAlgorithmType.None, true, false, 0, 0, 0, 0, 0); ! // scs.Add((0x00 << 0x08) | 0x02, "TLS_RSA_WITH_NULL_SHA", CipherAlgorithmType.None, HashAlgorithmType.Sha1, ExchangeAlgorithmType.None, true, false, 0, 0, 0, 0, 0); ! // scs.Add((0x00 << 0x08) | 0x03, "TLS_RSA_EXPORT_WITH_RC4_40_MD5", CipherAlgorithmType.Rc4, HashAlgorithmType.Md5, ExchangeAlgorithmType.RsaSignKeyX, true, false, 5, 16, 40, 0, 0); ! // scs.Add((0x00 << 0x08) | 0x05, "TLS_RSA_WITH_RC4_128_SHA", CipherAlgorithmType.Rc4, HashAlgorithmType.Sha1, ExchangeAlgorithmType.RsaSign, false, false, 16, 16, 128, 0, 0); ! // scs.Add((0x00 << 0x08) | 0x04, "TLS_RSA_WITH_RC4_128_MD5", CipherAlgorithmType.Rc4, HashAlgorithmType.Md5, ExchangeAlgorithmType.RsaSign, false, false, 16, 16, 128, 0, 0); ! // scs.Add((0x00 << 0x08) | 0x06, "TLS_RSA_EXPORT_WITH_RC2_CBC_40_MD5", CipherAlgorithmType.Rc2, HashAlgorithmType.Md5, ExchangeAlgorithmType.RsaKeyX, true, true, 5, 16, 40, 8, 8); ! // scs.Add((0x00 << 0x08) | 0x07, "TLS_RSA_WITH_IDEA_CBC_SHA", "IDEA", HashAlgorithmType.Sha1, ExchangeAlgorithmType.RsaSign, false, true, 16, 16, 128, 8, 8); ! // scs.Add((0x00 << 0x08) | 0x08, "TLS_RSA_EXPORT_WITH_DES40_CBC_SHA", CipherAlgorithmType.Des, HashAlgorithmType.Sha1, ExchangeAlgorithmType.RsaKeyX, true, true, 5, 8, 40, 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); ! // 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); ! ! // Diffie-Hellman Cipher Suites ! // scs.Add((0x00 << 0x08) | 0x0B, "TLS_DH_DSS_EXPORT_WITH_DES40_CBC_SHA", CipherAlgorithmType.Des, HashAlgorithmType.Sha1, ExchangeAlgorithmType.DiffieHellman, true, true, 5, 8, 40, 8, 8); ! // scs.Add((0x00 << 0x08) | 0x0C, "TLS_DH_DSS_WITH_DES_CBC_SHA", CipherAlgorithmType.Des, HashAlgorithmType.Sha1, false, ExchangeAlgorithmType.DiffieHellman, true, 8, 8, 56, 8, 8); ! // scs.Add((0x00 << 0x08) | 0x0D, "TLS_DH_DSS_WITH_3DES_EDE_CBC_SHA", CipherAlgorithmType.TripleDes, HashAlgorithmType.Sha1, ExchangeAlgorithmType.DiffieHellman, false, true, 24, 24, 168, 8, 8); ! // scs.Add((0x00 << 0x08) | 0x0E, "TLS_DH_RSA_EXPORT_WITH_DES40_CBC_SHA", CipherAlgorithmType.Des, HashAlgorithmType.Sha1, ExchangeAlgorithmType.DiffieHellman, true, true, 5, 8, 40, 8, 8); ! // scs.Add((0x00 << 0x08) | 0x0F, "TLS_DH_RSA_WITH_DES_CBC_SHA", CipherAlgorithmType.Des, HashAlgorithmType.Sha1, false, ExchangeAlgorithmType.DiffieHellman, true, 8, 8, 56, 8, 8); ! // scs.Add((0x00 << 0x08) | 0x10, "TLS_DH_RSA_WITH_3DES_EDE_CBC_SHA", CipherAlgorithmType.TripleDes, HashAlgorithmType.Sha1, ExchangeAlgorithmType.DiffieHellman, false, true, 24, 24, 168, 8, 8); ! // scs.Add((0x00 << 0x08) | 0x11, "TLS_DHE_DSS_EXPORT_WITH_DES40_CBC_SHA", CipherAlgorithmType.Des, HashAlgorithmType.Sha1, ExchangeAlgorithmType.DiffieHellman, true, true, 5, 8, 40, 8, 8); ! // scs.Add((0x00 << 0x08) | 0x12, "TLS_DHE_DSS_WITH_DES_CBC_SHA", CipherAlgorithmType.Des, HashAlgorithmType.Sha1, ExchangeAlgorithmType.DiffieHellman, false, true, 8, 8, 56, 8, 8); ! // scs.Add((0x00 << 0x08) | 0x13, "TLS_DHE_DSS_WITH_3DES_EDE_CBC_SHA", CipherAlgorithmType.TripleDes, HashAlgorithmType.Sha1, ExchangeAlgorithmType.DiffieHellman, false, true, 24, 24, 168, 8, 8); ! // scs.Add((0x00 << 0x08) | 0x14, "TLS_DHE_RSA_EXPORT_WITH_DES40_CBC_SHA", CipherAlgorithmType.Des, HashAlgorithmType.Sha1, ExchangeAlgorithmType.DiffieHellman, true, true, 5, 8, 40, 8, 8); ! // scs.Add((0x00 << 0x08) | 0x15, "TLS_DHE_RSA_WITH_DES_CBC_SHA", HashAlgorithmType.Sha1, CipherAlgorithmType.Des, false, ExchangeAlgorithmType.DiffieHellman, true, 8, 8, 56, 8, 8); ! // scs.Add((0x00 << 0x08) | 0x16, "TLS_DHE_RSA_WITH_3DES_EDE_CBC_SHA", CipherAlgorithmType.TripleDes, HashAlgorithmType.Sha1, ExchangeAlgorithmType.DiffieHellman, false, true, 24, 24, 168, 8, 8); ! ! // Anonymous Diffie-Hellman Cipher Suites ! // scs.Add((0x00 << 0x08) | 0x17, "TLS_DH_anon_EXPORT_WITH_RC4_40_MD5", CipherAlgorithmType.Rc4, HashAlgorithmType.Md5, ExchangeAlgorithmType.DiffieHellman, true, false, 5, 16, 40, 0, 0); ! // scs.Add((0x00 << 0x08) | 0x18, "TLS_DH_anon_WITH_RC4_128_MD5", CipherAlgorithmType.Rc4, HashAlgorithmType.Md5, false, ExchangeAlgorithmType.DiffieHellman, false, 16, 16, 128, 0, 0); ! // scs.Add((0x00 << 0x08) | 0x19, "TLS_DH_anon_EXPORT_WITH_DES40_CBC_SHA", CipherAlgorithmType.Des, HashAlgorithmType.Sha1, ExchangeAlgorithmType.DiffieHellman, false, true, 5, 8, 40, 8, 8); ! // scs.Add((0x00 << 0x08) | 0x1A, "TLS_DH_anon_WITH_DES_CBC_SHA", "DES4", HashAlgorithmType.Sha1, ExchangeAlgorithmType.DiffieHellman, false, true, 8, 8, 56, 8, 8); ! // scs.Add((0x00 << 0x08) | 0x1B, "TLS_DH_anon_WITH_3DES_EDE_CBC_SHA", CipherAlgorithmType.TripleDes, HashAlgorithmType.Sha1, ExchangeAlgorithmType.DiffieHellman, false, true, 24, 24, 168, 8, 8); ! ! // AES CipherSuites ! // ! // Ref: RFC3268 - (http://www.ietf.org/rfc/rfc3268.txt) ! ! // 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) | 0x30, "TLS_DH_DSS_WITH_AES_128_CBC_SHA", CipherAlgorithmType.Rijndael, HashAlgorithmType.Sha1, ExchangeAlgorithmType.DiffieHellman, false, true, 16, 16, 128, 8, 8); ! // scs.Add((0x00 << 0x08) | 0x31, "TLS_DH_RSA_WITH_AES_128_CBC_SHA", CipherAlgorithmType.Rijndael, HashAlgorithmType.Sha1, ExchangeAlgorithmType.DiffieHellman, false, true, 16, 16, 128, 8, 8); ! // scs.Add((0x00 << 0x08) | 0x32, "TLS_DHE_DSS_WITH_AES_128_CBC_SHA", CipherAlgorithmType.Rijndael, HashAlgorithmType.Sha1, ExchangeAlgorithmType.DiffieHellman, false, true, 16, 16, 128, 8, 8); ! // scs.Add((0x00 << 0x08) | 0x33, "TLS_DHE_RSA_WITH_AES_128_CBC_SHA", CipherAlgorithmType.Rijndael, HashAlgorithmType.Sha1, ExchangeAlgorithmType.DiffieHellman, false, true, 16, 16, 128, 8, 8); ! // scs.Add((0x00 << 0x08) | 0x34, "TLS_DH_anon_WITH_AES_128_CBC_SHA", CipherAlgorithmType.Rijndael, HashAlgorithmType.Sha1, ExchangeAlgorithmType.DiffieHellman, false, true, 16, 16, 128, 8, 8); ! ! // 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) | 0x36, "TLS_DH_DSS_WITH_AES_256_CBC_SHA", CipherAlgorithmType.Rijndael, HashAlgorithmType.Sha1, ExchangeAlgorithmType.DiffieHellman, false, true, 32, 32, 256, 16, 16); ! // scs.Add((0x00 << 0x08) | 0x37, "TLS_DH_RSA_WITH_AES_256_CBC_SHA", CipherAlgorithmType.Rijndael, HashAlgorithmType.Sha1, ExchangeAlgorithmType.DiffieHellman, false, true, 32, 32, 256, 16, 16); ! // scs.Add((0x00 << 0x08) | 0x38, "TLS_DHE_DSS_WITH_AES_256_CBC_SHA", CipherAlgorithmType.Rijndael, HashAlgorithmType.Sha1, ExchangeAlgorithmType.DiffieHellman, false, true, 32, 32, 256, 16, 16); ! // scs.Add((0x00 << 0x08) | 0x39, "TLS_DHE_RSA_WITH_AES_256_CBC_SHA", CipherAlgorithmType.Rijndael, HashAlgorithmType.Sha1, ExchangeAlgorithmType.DiffieHellman, false, true, 32, 32, 256, 16, 16); ! // scs.Add((0x00 << 0x08) | 0x3A, "TLS_DH_anon_WITH_AES_256_CBC_SHA", CipherAlgorithmType.Rijndael, HashAlgorithmType.Sha1, ExchangeAlgorithmType.DiffieHellman, false, true, 32, 32, 256, 16, 16); ! ! return scs; ! } ! ! private static TlsCipherSuiteCollection GetSsl3SupportedCiphers() ! { ! TlsCipherSuiteCollection scs = new TlsCipherSuiteCollection(SecurityProtocolType.Ssl3); ! ! // Supported ciphers ! scs.Add((0x00 << 0x08) | 0x0A, "SSL_RSA_WITH_3DES_EDE_CBC_SHA", CipherAlgorithmType.TripleDes, HashAlgorithmType.Sha1, ExchangeAlgorithmType.RsaSign, false, true, 24, 24, 168, 8, 8); ! scs.Add((0x00 << 0x08) | 0x09, "SSL_RSA_WITH_DES_CBC_SHA", CipherAlgorithmType.Des, HashAlgorithmType.Sha1, ExchangeAlgorithmType.RsaSign, false, true, 8, 8, 56, 8, 8); ! scs.Add((0x00 << 0x08) | 0x05, "SSL_RSA_WITH_RC4_128_SHA", CipherAlgorithmType.Rc4, HashAlgorithmType.Sha1, ExchangeAlgorithmType.RsaSign, false, false, 16, 16, 128, 0, 0); ! scs.Add((0x00 << 0x08) | 0x04, "SSL_RSA_WITH_RC4_128_MD5", CipherAlgorithmType.Rc4, HashAlgorithmType.Md5, ExchangeAlgorithmType.RsaSign, false, false, 16, 16, 128, 0, 0); ! ! // Default CipherSuite ! // scs.Add(0, "SSL_NULL_WITH_NULL_NULL", CipherAlgorithmType.None, HashAlgorithmType.None, true, false, 0, 0, 0, 0, 0); ! ! // RSA Cipher Suites ! // scs.Add((0x00 << 0x08) | 0x01, "SSL_RSA_WITH_NULL_MD5", CipherAlgorithmType.None, HashAlgorithmType.Md5, ExchangeAlgorithmType.None, true, false, 0, 0, 0, 0, 0); ! // scs.Add((0x00 << 0x08) | 0x02, "SSL_RSA_WITH_NULL_SHA", CipherAlgorithmType.None, HashAlgorithmType.Sha1, true, ExchangeAlgorithmType.None, false, 0, 0, 0, 0, 0); ! // scs.Add((0x00 << 0x08) | 0x03, "SSL_RSA_EXPORT_WITH_RC4_40_MD5", CipherAlgorithmType.Rc4, HashAlgorithmType.Md5, ExchangeAlgorithmType.RsaKeyX, true, false, 5, 16, 40, 0, 0); ! // scs.Add((0x00 << 0x08) | 0x05, "SSL_RSA_WITH_RC4_128_SHA", CipherAlgorithmType.Rc4, HashAlgorithmType.Sha1, ExchangeAlgorithmType.RsaSign, false, false, 16, 16, 128, 0, 0); ! // scs.Add((0x00 << 0x08) | 0x04, "SSL_RSA_WITH_RC4_128_MD5", CipherAlgorithmType.Rc4, HashAlgorithmType.Md5, ExchangeAlgorithmType.RsaSign, false, false, 16, 16, 128, 0, 0); ! // scs.Add((0x00 << 0x08) | 0x06, "SSL_RSA_EXPORT_WITH_RC2_CBC_40_MD5", CipherAlgorithmType.Rc2, HashAlgorithmType.Md5, ExchangeAlgorithmType.RsaKeyX, true, true, 5, 16, 40, 8, 8); ! // scs.Add((0x00 << 0x08) | 0x07, "SSL_RSA_WITH_IDEA_CBC_SHA", "IDEA", HashAlgorithmType.Sha1, ExchangeAlgorithmType.RsaSign, false, true, 16, 16, 128, 8, 8); ! // scs.Add((0x00 << 0x08) | 0x08, "SSL_RSA_EXPORT_WITH_DES40_CBC_SHA", CipherAlgorithmType.Des, HashAlgorithmType.Sha1, ExchangeAlgorithmType.RsaKeyEx, true, true, 5, 8, 40, 8, 8); ! // scs.Add((0x00 << 0x08) | 0x09, "SSL_RSA_WITH_DES_CBC_SHA", CipherAlgorithmType.Des, HashAlgorithmType.Sha1, ExchangeAlgorithmType.RsaSign, false, true, 8, 8, 56, 8, 8); ! // scs.Add((0x00 << 0x08) | 0x0A, "SSL_RSA_WITH_3DES_EDE_CBC_SHA", CipherAlgorithmType.TripleDes, HashAlgorithmType.Sha1, ExchangeAlgorithmType.RsaSign, false, true, 24, 24, 168, 8, 8); ! ! // Diffie-Hellman Cipher Suites ! // scs.Add((0x00 << 0x08) | 0x0B, "SSL_DH_DSS_EXPORT_WITH_DES40_CBC_SHA", CipherAlgorithmType.Des, HashAlgorithmType.Sha1, ExchangeAlgorithmType.DiffieHellman, true, true, 5, 8, 40, 8, 8); ! // scs.Add((0x00 << 0x08) | 0x0C, "SSL_DH_DSS_WITH_DES_CBC_SHA", CipherAlgorithmType.Des, HashAlgorithmType.Sha1, ExchangeAlgorithmType.DiffieHellman, false, true, 8, 8, 56, 8, 8); ! // scs.Add((0x00 << 0x08) | 0x0D, "SSL_DH_DSS_WITH_3DES_EDE_CBC_SHA", CipherAlgorithmType.TripleDes, HashAlgorithmType.Sha1, ExchangeAlgorithmType.DiffieHellman, false, true, 24, 24, 168, 8, 8); ! // scs.Add((0x00 << 0x08) | 0x0E, "SSL_DH_RSA_EXPORT_WITH_DES40_CBC_SHA", CipherAlgorithmType.Des, HashAlgorithmType.Sha1, ExchangeAlgorithmType.DiffieHellman, true, true, 5, 8, 40, 8, 8); ! // scs.Add((0x00 << 0x08) | 0x0F, "SSL_DH_RSA_WITH_DES_CBC_SHA", CipherAlgorithmType.Des, HashAlgorithmType.Sha1, ExchangeAlgorithmType.DiffieHellman, false, true, 8, 8, 56, 8, 8); ! // scs.Add((0x00 << 0x08) | 0x10, "SSL_DH_RSA_WITH_3DES_EDE_CBC_SHA", CipherAlgorithmType.TripleDes, HashAlgorithmType.Sha1, ExchangeAlgorithmType.DiffieHellman, false, true, 24, 24, 168, 8, 8); ! // scs.Add((0x00 << 0x08) | 0x11, "SSL_DHE_DSS_EXPORT_WITH_DES40_CBC_SHA", CipherAlgorithmType.Des, HashAlgorithmType.Sha1, ExchangeAlgorithmType.DiffieHellman, true, true, 5, 8, 40, 8, 8); ! // scs.Add((0x00 << 0x08) | 0x12, "SSL_DHE_DSS_WITH_DES_CBC_SHA", CipherAlgorithmType.Des, HashAlgorithmType.Sha1, ExchangeAlgorithmType.DiffieHellman, false, true, 8, 8, 56, 8, 8); ! // scs.Add((0x00 << 0x08) | 0x13, "SSL_DHE_DSS_WITH_3DES_EDE_CBC_SHA", CipherAlgorithmType.TripleDes, HashAlgorithmType.Sha1, ExchangeAlgorithmType.DiffieHellman, false, true, 24, 24, 168, 8, 8); ! // scs.Add((0x00 << 0x08) | 0x14, "SSL_DHE_RSA_EXPORT_WITH_DES40_CBC_SHA", CipherAlgorithmType.Des, HashAlgorithmType.Sha1, ExchangeAlgorithmType.DiffieHellman, true, true, 5, 8, 40, 8, 8); ! // scs.Add((0x00 << 0x08) | 0x15, "SSL_DHE_RSA_WITH_DES_CBC_SHA", HashAlgorithmType.Sha1, CipherAlgorithmType.Des, ExchangeAlgorithmType.DiffieHellman, false, true, 8, 8, 56, 8, 8); ! // scs.Add((0x00 << 0x08) | 0x16, "SSL_DHE_RSA_WITH_3DES_EDE_CBC_SHA", CipherAlgorithmType.TripleDes, HashAlgorithmType.Sha1, ExchangeAlgorithmType.DiffieHellman, false, true, 24, 24, 168, 8, 8); ! ! // Anonymous Diffie-Hellman Cipher Suites ! // scs.Add((0x00 << 0x08) | 0x17, "SSL_DH_anon_EXPORT_WITH_RC4_40_MD5", CipherAlgorithmType.Rc4, HashAlgorithmType.Md5, ExchangeAlgorithmType.DiffieHellman, true, false, 5, 16, 40, 0, 0); ! // scs.Add((0x00 << 0x08) | 0x18, "SSL_DH_anon_WITH_RC4_128_MD5", CipherAlgorithmType.Rc4, HashAlgorithmType.Md5, false, ExchangeAlgorithmType.DiffieHellman, false, 16, 16, 128, 0, 0); ! // scs.Add((0x00 << 0x08) | 0x19, "SSL_DH_anon_EXPORT_WITH_DES40_CBC_SHA", CipherAlgorithmType.Des, HashAlgorithmType.Sha1, ExchangeAlgorithmType.DiffieHellman, false, true, 5, 8, 40, 8, 8); ! // scs.Add((0x00 << 0x08) | 0x1A, "SSL_DH_anon_WITH_DES_CBC_SHA", "DES4", HashAlgorithmType.Sha1, ExchangeAlgorithmType.DiffieHellman, false, true, 8, 8, 56, 8, 8); ! // scs.Add((0x00 << 0x08) | 0x1B, "SSL_DH_anon_WITH_3DES_EDE_CBC_SHA", CipherAlgorithmType.TripleDes, HashAlgorithmType.Sha1, ExchangeAlgorithmType.DiffieHellman, false, true, 24, 24, 168, 8, 8); ! ! return scs; ! } ! ! #endregion ! } } --- 1,171 ---- ! /* Transport Security Layer (TLS) ! * Copyright (c) 2003 Carlos Guzmán Álvarez ! * ! * 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 ! { ! internal class TlsCipherSuiteFactory ! { ! public static TlsCipherSuiteCollection GetSupportedCiphers(SecurityProtocolType protocol) ! { ! switch (protocol) ! { ! case SecurityProtocolType.Ssl3: ! return TlsCipherSuiteFactory.GetSsl3SupportedCiphers(); ! ! case SecurityProtocolType.Tls: ! return TlsCipherSuiteFactory.GetTls1SupportedCiphers(); ! ! default: ! throw new NotSupportedException(); ! } ! } ! ! #region PRIVATE_STATIC_METHODS ! ! private static TlsCipherSuiteCollection GetTls1SupportedCiphers() ! { ! TlsCipherSuiteCollection scs = new TlsCipherSuiteCollection(SecurityProtocolType.Tls); ! ! // Supported ciphers ! scs.Add((0x00 << 0x08) | 0x06, "TLS_RSA_EXPORT_WITH_RC2_CBC_40_MD5", CipherAlgorithmType.Rc2, HashAlgorithmType.Md5, ExchangeAlgorithmType.RsaKeyX, true, true, 5, 16, 40, 8, 8); ! /* ! 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); ! scs.Add((0x00 << 0x08) | 0x05, "TLS_RSA_WITH_RC4_128_SHA", CipherAlgorithmType.Rc4, HashAlgorithmType.Sha1, ExchangeAlgorithmType.RsaSign, false, false, 16, 16, 128, 0, 0); ! scs.Add((0x00 << 0x08) | 0x04, "TLS_RSA_WITH_RC4_128_MD5", CipherAlgorithmType.Rc4, HashAlgorithmType.Md5, ExchangeAlgorithmType.RsaSign, false, false, 16, 16, 128, 0, 0); ! */ ! ! // Default CipherSuite ! // scs.Add(0, "TLS_NULL_WITH_NULL_NULL", CipherAlgorithmType.None, HashAlgorithmType.None, ExchangeAlgorithmType.None, true, false, 0, 0, 0, 0, 0); ! ! // RSA Cipher Suites ! // scs.Add((0x00 << 0x08) | 0x01, "TLS_RSA_WITH_NULL_MD5", CipherAlgorithmType.None, HashAlgorithmType.Md5, ExchangeAlgorithmType.None, true, false, 0, 0, 0, 0, 0); ! // scs.Add((0x00 << 0x08) | 0x02, "TLS_RSA_WITH_NULL_SHA", CipherAlgorithmType.None, HashAlgorithmType.Sha1, ExchangeAlgorithmType.None, true, false, 0, 0, 0, 0, 0); ! // scs.Add((0x00 << 0x08) | 0x03, "TLS_RSA_EXPORT_WITH_RC4_40_MD5", CipherAlgorithmType.Rc4, HashAlgorithmType.Md5, ExchangeAlgorithmType.RsaSignKeyX, true, false, 5, 16, 40, 0, 0); ! // scs.Add((0x00 << 0x08) | 0x05, "TLS_RSA_WITH_RC4_128_SHA", CipherAlgorithmType.Rc4, HashAlgorithmType.Sha1, ExchangeAlgorithmType.RsaSign, false, false, 16, 16, 128, 0, 0); ! // scs.Add((0x00 << 0x08) | 0x04, "TLS_RSA_WITH_RC4_128_MD5", CipherAlgorithmType.Rc4, HashAlgorithmType.Md5, ExchangeAlgorithmType.RsaSign, false, false, 16, 16, 128, 0, 0); ! // scs.Add((0x00 << 0x08) | 0x06, "TLS_RSA_EXPORT_WITH_RC2_CBC_40_MD5", CipherAlgorithmType.Rc2, HashAlgorithmType.Md5, ExchangeAlgorithmType.RsaKeyX, true, true, 5, 16, 40, 8, 8); ! // scs.Add((0x00 << 0x08) | 0x07, "TLS_RSA_WITH_IDEA_CBC_SHA", "IDEA", HashAlgorithmType.Sha1, ExchangeAlgorithmType.RsaSign, false, true, 16, 16, 128, 8, 8); ! // scs.Add((0x00 << 0x08) | 0x08, "TLS_RSA_EXPORT_WITH_DES40_CBC_SHA", CipherAlgorithmType.Des, HashAlgorithmType.Sha1, ExchangeAlgorithmType.RsaKeyX, true, true, 5, 8, 40, 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); ! // 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); ! ! // Diffie-Hellman Cipher Suites ! // scs.Add((0x00 << 0x08) | 0x0B, "TLS_DH_DSS_EXPORT_WITH_DES40_CBC_S... [truncated message content] |