pgsqlclient-checkins Mailing List for PostgreSqlClient (Page 21)
Status: Inactive
Brought to you by:
carlosga_fb
You can subscribe to this list here.
2003 |
Jan
|
Feb
|
Mar
|
Apr
|
May
|
Jun
|
Jul
(120) |
Aug
(95) |
Sep
(95) |
Oct
(213) |
Nov
(114) |
Dec
(64) |
---|---|---|---|---|---|---|---|---|---|---|---|---|
2004 |
Jan
(6) |
Feb
(134) |
Mar
(88) |
Apr
(28) |
May
(22) |
Jun
(15) |
Jul
(23) |
Aug
(2) |
Sep
(15) |
Oct
(2) |
Nov
(6) |
Dec
|
2005 |
Jan
(8) |
Feb
(6) |
Mar
|
Apr
(42) |
May
(3) |
Jun
|
Jul
|
Aug
|
Sep
(84) |
Oct
|
Nov
|
Dec
|
2006 |
Jan
|
Feb
|
Mar
(84) |
Apr
(46) |
May
(40) |
Jun
(8) |
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
Update of /cvsroot/pgsqlclient/pgsqlclient_10/Mono.Security/Mono.Security/Mono.Security.Cryptography In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv24444 Modified Files: ARC4Managed.cs RC4.cs RSAManaged.cs Added Files: CryptoTools.cs PKCS8.cs Log Message: Sync security stuff with mono CVS classes. --- NEW FILE: CryptoTools.cs --- // // Mono.Security.Cryptography.CryptoTools // Shared class for common cryptographic functionalities // // Authors: // Sebastien Pouliot (spo...@mo...) // // (C) 2002, 2003 Motus Technologies Inc. (http://www.motus.com) // using System; using System.Security.Cryptography; namespace Mono.Security.Cryptography { internal class KeyBuilder { static private RandomNumberGenerator rng; static KeyBuilder () { rng = RandomNumberGenerator.Create (); } static public byte[] Key (int size) { byte[] key = new byte [size]; rng.GetBytes (key); return key; } static public byte[] IV (int size) { byte[] iv = new byte [size]; rng.GetBytes (iv); return iv; } } // Process an array as a sequence of blocks internal class BlockProcessor { private ICryptoTransform transform; private byte[] block; private int blockSize; // in bytes (not in bits) private int blockCount; public BlockProcessor (ICryptoTransform transform) : this (transform, transform.InputBlockSize) {} // some Transforms (like HashAlgorithm descendant) return 1 for // block size (which isn't their real internal block size) public BlockProcessor (ICryptoTransform transform, int blockSize) { this.transform = transform; this.blockSize = blockSize; block = new byte [blockSize]; } ~BlockProcessor () { // zeroize our block (so we don't retain any information) Array.Clear (block, 0, blockSize); } public void Initialize () { Array.Clear (block, 0, blockSize); blockCount = 0; } public void Core (byte[] rgb) { Core (rgb, 0, rgb.Length); } public void Core (byte[] rgb, int ib, int cb) { // 1. fill the rest of the "block" int n = System.Math.Min (blockSize - blockCount, cb); Array.Copy (rgb, ib, block, blockCount, n); blockCount += n; // 2. if block is full then transform it if (blockCount == blockSize) { transform.TransformBlock (block, 0, blockSize, block, 0); // 3. transform any other full block in specified buffer int b = (int) ((cb - n) / blockSize); for (int i=0; i < b; i++) { transform.TransformBlock (rgb, n, blockSize, block, 0); n += blockSize; } // 4. if data is still present fill the "block" with the remainder blockCount = cb - n; if (blockCount > 0) Array.Copy (rgb, n, block, 0, blockCount); } } public byte[] Final () { return transform.TransformFinalBlock (block, 0, blockCount); } } } --- NEW FILE: PKCS8.cs --- // // PKCS8.cs: PKCS #8 - Private-Key Information Syntax Standard // ftp://ftp.rsasecurity.com/pub/pkcs/doc/pkcs-8.doc // // Author: // Sebastien Pouliot (spo...@mo...) // // (C) 2003 Motus Technologies Inc. (http://www.motus.com) // using System; using System.Collections; using System.Security.Cryptography; using System.Text; using Mono.Security.Cryptography; using Mono.Security.X509; namespace Mono.Security.Cryptography { internal class PKCS8 { public enum KeyInfo { PrivateKey, EncryptedPrivateKey, Unknown } static public KeyInfo GetType (byte[] data) { if (data == null) throw new ArgumentNullException ("data"); KeyInfo ki = KeyInfo.Unknown; try { ASN1 top = new ASN1 (data); if ((top.Tag == 0x30) && (top.Count > 0)) { ASN1 firstLevel = top [0]; switch (firstLevel.Tag) { case 0x02: ki = KeyInfo.PrivateKey; break; case 0x30: ki = KeyInfo.EncryptedPrivateKey; break; } } } catch { throw new CryptographicException ("invalid ASN.1 data"); } return ki; } /* * PrivateKeyInfo ::= SEQUENCE { * version Version, * privateKeyAlgorithm PrivateKeyAlgorithmIdentifier, * privateKey PrivateKey, * attributes [0] IMPLICIT Attributes OPTIONAL * } * * Version ::= INTEGER * * PrivateKeyAlgorithmIdentifier ::= AlgorithmIdentifier * * PrivateKey ::= OCTET STRING * * Attributes ::= SET OF Attribute */ public class PrivateKeyInfo { private int _version; private string _algorithm; private byte[] _key; private ArrayList _list; public PrivateKeyInfo () { _version = 0; _list = new ArrayList (); } public PrivateKeyInfo (byte[] data) : this () { Decode (data); } // properties public string Algorithm { get { return _algorithm; } set { _algorithm = value; } } public ArrayList Attributes { get { return _list; } } public byte[] PrivateKey { get { return _key; } set { _key = value; } } public int Version { get { return _version; } set { if (_version < 0) throw new ArgumentOutOfRangeException ("negative version"); _version = value; } } // methods private void Decode (byte[] data) { ASN1 privateKeyInfo = new ASN1 (data); if (privateKeyInfo.Tag != 0x30) throw new CryptographicException ("invalid PrivateKeyInfo"); ASN1 version = privateKeyInfo [0]; if (version.Tag != 0x02) throw new CryptographicException ("invalid version"); _version = version.Value [0]; ASN1 privateKeyAlgorithm = privateKeyInfo [1]; if (privateKeyAlgorithm.Tag != 0x30) throw new CryptographicException ("invalid algorithm"); ASN1 algorithm = privateKeyAlgorithm [0]; if (algorithm.Tag != 0x06) throw new CryptographicException ("missing algorithm OID"); _algorithm = ASN1Convert.ToOID (algorithm); ASN1 privateKey = privateKeyInfo [2]; _key = privateKey.Value; // attributes [0] IMPLICIT Attributes OPTIONAL if (privateKeyInfo.Count > 3) { ASN1 attributes = privateKeyInfo [3]; for (int i=0; i < attributes.Count; i++) { _list.Add (attributes [i]); } } } // TODO public byte[] GetBytes () { return null; } // static methods static private byte[] RemoveLeadingZero (byte[] bigInt) { int start = 0; int length = bigInt.Length; if (bigInt [0] == 0x00) { start = 1; length--; } byte[] bi = new byte [length]; Buffer.BlockCopy (bigInt, start, bi, 0, length); return bi; } static private byte[] Normalize (byte[] bigInt, int length) { if (bigInt.Length == length) return bigInt; else if (bigInt.Length > length) return RemoveLeadingZero (bigInt); else { // pad with 0 byte[] bi = new byte [length]; Buffer.BlockCopy (bigInt, 0, bi, (length - bigInt.Length), bigInt.Length); return bi; } } /* * RSAPrivateKey ::= SEQUENCE { * version Version, * modulus INTEGER, -- n * publicExponent INTEGER, -- e * privateExponent INTEGER, -- d * prime1 INTEGER, -- p * prime2 INTEGER, -- q * exponent1 INTEGER, -- d mod (p-1) * exponent2 INTEGER, -- d mod (q-1) * coefficient INTEGER, -- (inverse of q) mod p * otherPrimeInfos OtherPrimeInfos OPTIONAL * } */ static public RSA DecodeRSA (byte[] encryptedKeypair) { ASN1 privateKey = new ASN1 (encryptedKeypair); if (privateKey.Tag != 0x30) throw new CryptographicException ("invalid private key format"); ASN1 version = privateKey [0]; if (version.Tag != 0x02) throw new CryptographicException ("missing version"); if (privateKey.Count < 9) throw new CryptographicException ("not enough key parameters"); RSAParameters param = new RSAParameters (); // note: MUST remove leading 0 - else MS wont import the key param.Modulus = RemoveLeadingZero (privateKey [1].Value); int keysize = param.Modulus.Length; int keysize2 = (keysize >> 1); // half-size // size must be normalized - else MS wont import the key param.D = Normalize (privateKey [3].Value, keysize); param.DP = Normalize (privateKey [6].Value, keysize2); param.DQ = Normalize (privateKey [7].Value, keysize2); param.Exponent = RemoveLeadingZero (privateKey [2].Value); param.InverseQ = Normalize (privateKey [8].Value, keysize2); param.P = Normalize (privateKey [4].Value, keysize2); param.Q = Normalize (privateKey [5].Value, keysize2); RSA rsa = RSA.Create (); rsa.ImportParameters (param); return rsa; } // DSA only encode it's X private key inside an ASN.1 INTEGER (Hint: Tag == 0x02) // which isn't enough for rebuilding the keypair. The other parameters // can be found (98% of the time) in the X.509 certificate associated // with the private key or (2% of the time) the parameters are in it's // issuer X.509 certificate (not supported in the .NET framework). static public DSA DecodeDSA (byte[] encryptedPrivateKey, DSAParameters dsaParameters) { ASN1 privateKey = new ASN1 (encryptedPrivateKey); if (privateKey.Tag != 0x02) throw new CryptographicException ("invalid private key format"); // X is ALWAYS 20 bytes (no matter if the key length is 512 or 1024 bits) dsaParameters.X = Normalize (encryptedPrivateKey, 20); DSA dsa = DSA.Create (); dsa.ImportParameters (dsaParameters); return dsa; } } /* * EncryptedPrivateKeyInfo ::= SEQUENCE { * encryptionAlgorithm EncryptionAlgorithmIdentifier, * encryptedData EncryptedData * } * * EncryptionAlgorithmIdentifier ::= AlgorithmIdentifier * * EncryptedData ::= OCTET STRING * * -- * AlgorithmIdentifier ::= SEQUENCE { * algorithm OBJECT IDENTIFIER, * parameters ANY DEFINED BY algorithm OPTIONAL * } * * -- from PKCS#5 * PBEParameter ::= SEQUENCE { * salt OCTET STRING SIZE(8), * iterationCount INTEGER * } */ public class EncryptedPrivateKeyInfo { private string _algorithm; private byte[] _salt; private int _iterations; private byte[] _data; public EncryptedPrivateKeyInfo () {} public EncryptedPrivateKeyInfo (byte[] data) : this () { Decode (data); } // properties public string Algorithm { get { return _algorithm; } } public byte[] EncryptedData { get { return (byte[]) _data.Clone (); } } public byte[] Salt { get { return (byte[]) _salt.Clone (); } } public int IterationCount { get { return _iterations; } } // methods private void Decode (byte[] data) { ASN1 encryptedPrivateKeyInfo = new ASN1 (data); if (encryptedPrivateKeyInfo.Tag != 0x30) throw new CryptographicException ("invalid EncryptedPrivateKeyInfo"); ASN1 encryptionAlgorithm = encryptedPrivateKeyInfo [0]; if (encryptionAlgorithm.Tag != 0x30) throw new CryptographicException ("invalid encryptionAlgorithm"); ASN1 algorithm = encryptionAlgorithm [0]; if (algorithm.Tag != 0x06) throw new CryptographicException ("invalid algorithm"); _algorithm = ASN1Convert.ToOID (algorithm); // parameters ANY DEFINED BY algorithm OPTIONAL if (encryptionAlgorithm.Count > 1) { ASN1 parameters = encryptionAlgorithm [1]; if (parameters.Tag != 0x30) throw new CryptographicException ("invalid parameters"); ASN1 salt = parameters [0]; if (salt.Tag != 0x04) throw new CryptographicException ("invalid salt"); _salt = salt.Value; ASN1 iterationCount = parameters [1]; if (iterationCount.Tag != 0x02) throw new CryptographicException ("invalid iterationCount"); _iterations = ASN1Convert.ToInt32 (iterationCount); } ASN1 encryptedData = encryptedPrivateKeyInfo [1]; if (encryptedData.Tag != 0x04) throw new CryptographicException ("invalid EncryptedData"); _data = encryptedData.Value; } // Note: PKCS#8 doesn't define how to generate the key required for encryption // so you're on your own. Just don't try to copy the big guys too much ;) // Netscape: http://www.cs.auckland.ac.nz/~pgut001/pubs/netscape.txt // Microsoft: http://www.cs.auckland.ac.nz/~pgut001/pubs/breakms.txt public byte[] GetBytes (byte[] encryptedPrivateKey) { // TODO return null; } } } } Index: ARC4Managed.cs =================================================================== RCS file: /cvsroot/pgsqlclient/pgsqlclient_10/Mono.Security/Mono.Security/Mono.Security.Cryptography/ARC4Managed.cs,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** ARC4Managed.cs 10 Feb 2004 09:43:04 -0000 1.1 --- ARC4Managed.cs 5 Mar 2004 23:15:21 -0000 1.2 *************** *** 13,17 **** // http://www.qrst.de/html/dsds/rc4.htm ! internal class ARC4Managed : RC4, ICryptoTransform { private byte[] key; --- 13,17 ---- // http://www.qrst.de/html/dsds/rc4.htm ! public class ARC4Managed : RC4, ICryptoTransform { private byte[] key; *************** *** 80,87 **** public override void GenerateKey () { ! byte[] key = new byte [KeySizeValue >> 3]; ! RandomNumberGenerator rng = RandomNumberGenerator.Create (); ! rng.GetBytes (key); ! Key = key; } --- 80,84 ---- public override void GenerateKey () { ! Key = KeyBuilder.Key (KeySizeValue >> 3); } *************** *** 108,112 **** y = 0; for (int counter = 0; counter < 256; counter++) { ! index2 = (byte) ((key [index1] + state [counter] + index2) % 256); // swap byte byte tmp = state [counter]; --- 105,109 ---- y = 0; for (int counter = 0; counter < 256; counter++) { ! index2 = (byte) (key [index1] + state [counter] + index2); // swap byte byte tmp = state [counter]; *************** *** 121,126 **** byte xorIndex; for (int counter = 0; counter < inputCount; counter ++) { ! x = (byte) ((x + 1) % 256); ! y = (byte) ((state [x] + y) % 256); // swap byte byte tmp = state [x]; --- 118,123 ---- byte xorIndex; for (int counter = 0; counter < inputCount; counter ++) { ! x = (byte) (x + 1); ! y = (byte) (state [x] + y); // swap byte byte tmp = state [x]; *************** *** 128,132 **** state [y] = tmp; ! xorIndex = (byte) (state [x] + (state [y]) % 256); outputBuffer [outputOffset + counter] = (byte) (inputBuffer [inputOffset + counter] ^ state [xorIndex]); } --- 125,129 ---- state [y] = tmp; ! xorIndex = (byte) (state [x] + state [y]); outputBuffer [outputOffset + counter] = (byte) (inputBuffer [inputOffset + counter] ^ state [xorIndex]); } Index: RC4.cs =================================================================== RCS file: /cvsroot/pgsqlclient/pgsqlclient_10/Mono.Security/Mono.Security/Mono.Security.Cryptography/RC4.cs,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** RC4.cs 10 Feb 2004 09:43:04 -0000 1.1 --- RC4.cs 5 Mar 2004 23:15:21 -0000 1.2 *************** *** 14,18 **** namespace Mono.Security.Cryptography { ! internal abstract class RC4 : SymmetricAlgorithm { private static KeySizes[] s_legalBlockSizes = { --- 14,18 ---- namespace Mono.Security.Cryptography { ! public abstract class RC4 : SymmetricAlgorithm { private static KeySizes[] s_legalBlockSizes = { Index: RSAManaged.cs =================================================================== RCS file: /cvsroot/pgsqlclient/pgsqlclient_10/Mono.Security/Mono.Security/Mono.Security.Cryptography/RSAManaged.cs,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** RSAManaged.cs 10 Feb 2004 09:43:04 -0000 1.1 --- RSAManaged.cs 5 Mar 2004 23:15:21 -0000 1.2 *************** *** 28,32 **** namespace Mono.Security.Cryptography { ! internal class RSAManaged : RSA { private const int defaultKeySize = 1024; --- 28,37 ---- namespace Mono.Security.Cryptography { ! #if INSIDE_CORLIB ! internal ! #else ! public ! #endif ! class RSAManaged : RSA { private const int defaultKeySize = 1024; *************** *** 109,112 **** --- 114,120 ---- keypairGenerated = true; isCRTpossible = true; + + if (KeyGenerated != null) + KeyGenerated (this); } *************** *** 126,129 **** --- 134,143 ---- } + // note: this property will exist in RSACryptoServiceProvider in + // version 1.2 of the framework + public bool PublicOnly { + get { return ((d == null) || (n == null)); } + } + public override string SignatureAlgorithm { get { return "http://www.w3.org/2000/09/xmldsig#rsa-sha1"; } *************** *** 288,291 **** --- 302,309 ---- m_disposed = true; } + + public delegate void KeyGeneratedEventHandler (object sender); + + public event KeyGeneratedEventHandler KeyGenerated; } } |
From: <car...@us...> - 2004-03-05 23:28:47
|
Update of /cvsroot/pgsqlclient/pgsqlclient_10/Mono.Security/Mono.Security/Mono.Security In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv24214 Added Files: PKCS7.cs Log Message: Sync security stuff with mono CVS classes. --- NEW FILE: PKCS7.cs --- // // PKCS7.cs: PKCS #7 - Cryptographic Message Syntax Standard // http://www.rsasecurity.com/rsalabs/pkcs/pkcs-7/index.html // // Author: // Sebastien Pouliot (spo...@mo...) // // (C) 2002, 2003 Motus Technologies Inc. (http://www.motus.com) // using System; using System.Collections; using System.Security.Cryptography; //using System.Security.Cryptography.X509Certificates; using Mono.Security.X509; namespace Mono.Security { internal class PKCS7 { // pkcs 1 public const string rsaEncryption = "1.2.840.113549.1.1.1"; // pkcs 7 public const string data = "1.2.840.113549.1.7.1"; public const string signedData = "1.2.840.113549.1.7.2"; public const string envelopedData = "1.2.840.113549.1.7.3"; public const string signedAndEnvelopedData = "1.2.840.113549.1.7.4"; public const string digestedData = "1.2.840.113549.1.7.5"; public const string encryptedData = "1.2.840.113549.1.7.6"; // pkcs 9 public const string contentType = "1.2.840.113549.1.9.3"; public const string messageDigest = "1.2.840.113549.1.9.4"; public const string signingTime = "1.2.840.113549.1.9.5"; public const string countersignature = "1.2.840.113549.1.9.6"; public PKCS7 () {} static public ASN1 Attribute (string oid, ASN1 value) { ASN1 attr = new ASN1 (0x30); attr.Add (ASN1Convert.FromOID (oid)); ASN1 aset = attr.Add (new ASN1 (0x31)); aset.Add (value); return attr; } static public ASN1 AlgorithmIdentifier (string oid) { ASN1 ai = new ASN1 (0x30); ai.Add (ASN1Convert.FromOID (oid)); ai.Add (new ASN1 (0x05)); // NULL return ai; } static public ASN1 AlgorithmIdentifier (string oid, ASN1 param) { ASN1 ai = new ASN1 (0x30); ai.Add (ASN1Convert.FromOID (oid)); ai.Add (param); return ai; } /* * IssuerAndSerialNumber ::= SEQUENCE { * issuer Name, * serialNumber CertificateSerialNumber * } */ static public ASN1 IssuerAndSerialNumber (X509Certificate x509) { ASN1 issuer = null; ASN1 serial = null; ASN1 cert = new ASN1 (x509.RawData); int tbs = 0; bool flag = false; while (tbs < cert[0].Count) { ASN1 e = cert[0][tbs++]; if (e.Tag == 0x02) serial = e; else if (e.Tag == 0x30) { if (flag) { issuer = e; break; } flag = true; } } ASN1 iasn = new ASN1 (0x30); iasn.Add (issuer); iasn.Add (serial); return iasn; } /* * ContentInfo ::= SEQUENCE { * contentType ContentType, * content [0] EXPLICIT ANY DEFINED BY contentType OPTIONAL * } * ContentType ::= OBJECT IDENTIFIER */ public class ContentInfo { private string contentType; private ASN1 content; public ContentInfo () { content = new ASN1 (0xA0); } public ContentInfo (string oid) : this () { contentType = oid; } public ContentInfo (byte[] data) : this (new ASN1 (data)) {} public ContentInfo (ASN1 asn1) { // SEQUENCE with 1 or 2 elements if ((asn1.Tag != 0x30) || ((asn1.Count < 1) && (asn1.Count > 2))) throw new ArgumentException ("Invalid ASN1"); if (asn1[0].Tag != 0x06) throw new ArgumentException ("Invalid contentType"); contentType = ASN1Convert.ToOID (asn1[0]); if (asn1.Count > 1) { if (asn1[1].Tag != 0xA0) throw new ArgumentException ("Invalid content"); content = asn1[1]; } } public ASN1 ASN1 { get { return GetASN1(); } } public ASN1 Content { get { return content; } set { content = value; } } public string ContentType { get { return contentType; } set { contentType = value; } } internal ASN1 GetASN1 () { // ContentInfo ::= SEQUENCE { ASN1 contentInfo = new ASN1 (0x30); // contentType ContentType, -> ContentType ::= OBJECT IDENTIFIER contentInfo.Add (ASN1Convert.FromOID (contentType)); // content [0] EXPLICIT ANY DEFINED BY contentType OPTIONAL if ((content != null) && (content.Count > 0)) contentInfo.Add (content); return contentInfo; } public byte[] GetBytes () { return GetASN1 ().GetBytes (); } } /* * EncryptedData ::= SEQUENCE { * version INTEGER {edVer0(0)} (edVer0), * encryptedContentInfo EncryptedContentInfo * } */ public class EncryptedData { private byte _version; private ContentInfo _content; private ContentInfo _encryptionAlgorithm; private byte[] _encrypted; public EncryptedData () { _version = 0; } public EncryptedData (byte[] data) : this (new ASN1 (data)) {} public EncryptedData (ASN1 asn1) : this () { if ((asn1.Tag != 0x30) || (asn1.Count < 2)) throw new ArgumentException ("Invalid EncryptedData"); if (asn1 [0].Tag != 0x02) throw new ArgumentException ("Invalid version"); _version = asn1 [0].Value [0]; ASN1 encryptedContentInfo = asn1 [1]; if (encryptedContentInfo.Tag != 0x30) throw new ArgumentException ("missing EncryptedContentInfo"); ASN1 contentType = encryptedContentInfo [0]; if (contentType.Tag != 0x06) throw new ArgumentException ("missing EncryptedContentInfo.ContentType"); _content = new ContentInfo (ASN1Convert.ToOID (contentType)); ASN1 contentEncryptionAlgorithm = encryptedContentInfo [1]; if (contentEncryptionAlgorithm.Tag != 0x30) throw new ArgumentException ("missing EncryptedContentInfo.ContentEncryptionAlgorithmIdentifier"); _encryptionAlgorithm = new ContentInfo (ASN1Convert.ToOID (contentEncryptionAlgorithm [0])); _encryptionAlgorithm.Content = contentEncryptionAlgorithm [1]; ASN1 encryptedContent = encryptedContentInfo [2]; if (encryptedContent.Tag != 0x80) throw new ArgumentException ("missing EncryptedContentInfo.EncryptedContent"); _encrypted = encryptedContent.Value; } public ASN1 ASN1 { get { return GetASN1(); } } public ContentInfo ContentInfo { get { return _content; } } public ContentInfo EncryptionAlgorithm { get { return _encryptionAlgorithm; } } public byte[] EncryptedContent { get { return _encrypted; } } public byte Version { get { return _version; } set { _version = value; } } // methods internal ASN1 GetASN1 () { return null; } public byte[] GetBytes () { return GetASN1 ().GetBytes (); } } /* * EnvelopedData ::= SEQUENCE { * version Version, * recipientInfos RecipientInfos, * encryptedContentInfo EncryptedContentInfo * } * * RecipientInfos ::= SET OF RecipientInfo * * EncryptedContentInfo ::= SEQUENCE { * contentType ContentType, * contentEncryptionAlgorithm ContentEncryptionAlgorithmIdentifier, * encryptedContent [0] IMPLICIT EncryptedContent OPTIONAL * } * * EncryptedContent ::= OCTET STRING * */ public class EnvelopedData { private byte _version; private ContentInfo _content; private ContentInfo _encryptionAlgorithm; private ArrayList _recipientInfos; private byte[] _encrypted; public EnvelopedData () { _version = 0; _content = new ContentInfo (); _encryptionAlgorithm = new ContentInfo (); _recipientInfos = new ArrayList (); } public EnvelopedData (byte[] data) : this (new ASN1 (data)) {} public EnvelopedData (ASN1 asn1) : this () { if ((asn1[0].Tag != 0x30) || (asn1[0].Count < 3)) throw new ArgumentException ("Invalid EnvelopedData"); if (asn1[0][0].Tag != 0x02) throw new ArgumentException ("Invalid version"); _version = asn1[0][0].Value[0]; // recipientInfos ASN1 recipientInfos = asn1 [0][1]; if (recipientInfos.Tag != 0x31) throw new ArgumentException ("missing RecipientInfos"); for (int i=0; i < recipientInfos.Count; i++) { ASN1 recipientInfo = recipientInfos [i]; _recipientInfos.Add (new RecipientInfo (recipientInfo)); } ASN1 encryptedContentInfo = asn1[0][2]; if (encryptedContentInfo.Tag != 0x30) throw new ArgumentException ("missing EncryptedContentInfo"); ASN1 contentType = encryptedContentInfo [0]; if (contentType.Tag != 0x06) throw new ArgumentException ("missing EncryptedContentInfo.ContentType"); _content = new ContentInfo (ASN1Convert.ToOID (contentType)); ASN1 contentEncryptionAlgorithm = encryptedContentInfo [1]; if (contentEncryptionAlgorithm.Tag != 0x30) throw new ArgumentException ("missing EncryptedContentInfo.ContentEncryptionAlgorithmIdentifier"); _encryptionAlgorithm = new ContentInfo (ASN1Convert.ToOID (contentEncryptionAlgorithm [0])); _encryptionAlgorithm.Content = contentEncryptionAlgorithm [1]; ASN1 encryptedContent = encryptedContentInfo [2]; if (encryptedContent.Tag != 0x80) throw new ArgumentException ("missing EncryptedContentInfo.EncryptedContent"); _encrypted = encryptedContent.Value; } public ArrayList RecipientInfos { get { return _recipientInfos; } } public ASN1 ASN1 { get { return GetASN1(); } } public ContentInfo ContentInfo { get { return _content; } } public ContentInfo EncryptionAlgorithm { get { return _encryptionAlgorithm; } } public byte[] EncryptedContent { get { return _encrypted; } } public byte Version { get { return _version; } set { _version = value; } } internal ASN1 GetASN1 () { // SignedData ::= SEQUENCE { ASN1 signedData = new ASN1 (0x30); // version Version -> Version ::= INTEGER /* byte[] ver = { _version }; signedData.Add (new ASN1 (0x02, ver)); // digestAlgorithms DigestAlgorithmIdentifiers -> DigestAlgorithmIdentifiers ::= SET OF DigestAlgorithmIdentifier ASN1 digestAlgorithms = signedData.Add (new ASN1 (0x31)); if (hashAlgorithm != null) { string hashOid = CryptoConfig.MapNameToOID (hashAlgorithm); digestAlgorithms.Add (AlgorithmIdentifier (hashOid)); } // contentInfo ContentInfo, ASN1 ci = contentInfo.ASN1; signedData.Add (ci); if ((mda == null) && (hashAlgorithm != null)) { // automatically add the messageDigest authenticated attribute HashAlgorithm ha = HashAlgorithm.Create (hashAlgorithm); byte[] idcHash = ha.ComputeHash (ci[1][0].Value); ASN1 md = new ASN1 (0x30); mda = Attribute (messageDigest, md.Add (new ASN1 (0x04, idcHash))); signerInfo.AuthenticatedAttributes.Add (mda); } // certificates [0] IMPLICIT ExtendedCertificatesAndCertificates OPTIONAL, if (certs.Count > 0) { ASN1 a0 = signedData.Add (new ASN1 (0xA0)); foreach (X509Certificate x in certs) a0.Add (new ASN1 (x.RawData)); } // crls [1] IMPLICIT CertificateRevocationLists OPTIONAL, if (crls.Count > 0) { ASN1 a1 = signedData.Add (new ASN1 (0xA1)); foreach (byte[] crl in crls) a1.Add (new ASN1 (crl)); } // signerInfos SignerInfos -> SignerInfos ::= SET OF SignerInfo ASN1 signerInfos = signedData.Add (new ASN1 (0x31)); if (signerInfo.Key != null) signerInfos.Add (signerInfo.ASN1);*/ return signedData; } public byte[] GetBytes () { return GetASN1 ().GetBytes (); } } /* RecipientInfo ::= SEQUENCE { * version Version, * issuerAndSerialNumber IssuerAndSerialNumber, * keyEncryptionAlgorithm KeyEncryptionAlgorithmIdentifier, * encryptedKey EncryptedKey * } * * KeyEncryptionAlgorithmIdentifier ::= AlgorithmIdentifier * * EncryptedKey ::= OCTET STRING */ public class RecipientInfo { private int _version; private string _oid; private byte[] _key; private byte[] _ski; private string _issuer; private byte[] _serial; public RecipientInfo () {} public RecipientInfo (ASN1 data) { if (data.Tag != 0x30) throw new ArgumentException ("Invalid RecipientInfo"); ASN1 version = data [0]; if (version.Tag != 0x02) throw new ArgumentException ("missing Version"); _version = version.Value [0]; // issuerAndSerialNumber IssuerAndSerialNumber ASN1 subjectIdentifierType = data [1]; if ((subjectIdentifierType.Tag == 0x80) && (_version == 3)) { _ski = subjectIdentifierType.Value; } else { _issuer = X501.ToString (subjectIdentifierType [0]); _serial = subjectIdentifierType [1].Value; } ASN1 keyEncryptionAlgorithm = data [2]; _oid = ASN1Convert.ToOID (keyEncryptionAlgorithm [0]); ASN1 encryptedKey = data [3]; _key = encryptedKey.Value; } public string Oid { get { return _oid; } } public byte[] Key { get { return _key; } } public byte[] SubjectKeyIdentifier { get { return _ski; } } public string Issuer { get { return _issuer; } } public byte[] Serial { get { return _serial; } } public int Version { get { return _version; } } } /* * SignedData ::= SEQUENCE { * version Version, * digestAlgorithms DigestAlgorithmIdentifiers, * contentInfo ContentInfo, * certificates [0] IMPLICIT ExtendedCertificatesAndCertificates OPTIONAL, * crls [1] IMPLICIT CertificateRevocationLists OPTIONAL, * signerInfos SignerInfos * } */ public class SignedData { private byte version; private string hashAlgorithm; private ContentInfo contentInfo; private X509CertificateCollection certs; private ArrayList crls; private SignerInfo signerInfo; private ASN1 mda; public SignedData () { version = 1; contentInfo = new ContentInfo (); certs = new X509CertificateCollection (); crls = new ArrayList (); signerInfo = new SignerInfo (); } public SignedData (byte[] data) : this (new ASN1 (data)) {} public SignedData (ASN1 asn1) { if ((asn1[0].Tag != 0x30) || (asn1[0].Count < 4)) throw new ArgumentException ("Invalid SignedData"); if (asn1[0][0].Tag != 0x02) throw new ArgumentException ("Invalid version"); version = asn1[0][0].Value[0]; // digestInfo contentInfo = new ContentInfo (asn1[0][2]); int n = 3; certs = new X509CertificateCollection (); if (asn1[0][n].Tag == 0xA0) { for (int i=0; i < asn1[0][n].Count; i++) certs.Add (new X509Certificate (asn1[0][n][i].GetBytes ())); n++; } crls = new ArrayList (); if (asn1[0][n].Tag == 0xA1) { for (int i=0; i < asn1[0][n].Count; i++) crls.Add (asn1[0][n][i].GetBytes ()); n++; } if (asn1[0][n].Count > 0) signerInfo = new SignerInfo (asn1[0][n]); else signerInfo = new SignerInfo (); } public ASN1 ASN1 { get { return GetASN1(); } } public X509CertificateCollection Certificates { get { return certs; } } public ContentInfo ContentInfo { get { return contentInfo; } } public ArrayList CRLs { get { return crls; } } public string HashName { get { return hashAlgorithm; } // todo add validation set { hashAlgorithm = value; signerInfo.HashName = value; } } public SignerInfo SignerInfo { get { return signerInfo; } } public byte Version { get { return version; } set { version = value; } } internal ASN1 GetASN1 () { // SignedData ::= SEQUENCE { ASN1 signedData = new ASN1 (0x30); // version Version -> Version ::= INTEGER byte[] ver = { version }; signedData.Add (new ASN1 (0x02, ver)); // digestAlgorithms DigestAlgorithmIdentifiers -> DigestAlgorithmIdentifiers ::= SET OF DigestAlgorithmIdentifier ASN1 digestAlgorithms = signedData.Add (new ASN1 (0x31)); if (hashAlgorithm != null) { string hashOid = CryptoConfig.MapNameToOID (hashAlgorithm); digestAlgorithms.Add (AlgorithmIdentifier (hashOid)); } // contentInfo ContentInfo, ASN1 ci = contentInfo.ASN1; signedData.Add (ci); if ((mda == null) && (hashAlgorithm != null)) { // automatically add the messageDigest authenticated attribute HashAlgorithm ha = HashAlgorithm.Create (hashAlgorithm); byte[] idcHash = ha.ComputeHash (ci[1][0].Value); ASN1 md = new ASN1 (0x30); mda = Attribute (messageDigest, md.Add (new ASN1 (0x04, idcHash))); signerInfo.AuthenticatedAttributes.Add (mda); } // certificates [0] IMPLICIT ExtendedCertificatesAndCertificates OPTIONAL, if (certs.Count > 0) { ASN1 a0 = signedData.Add (new ASN1 (0xA0)); foreach (X509Certificate x in certs) a0.Add (new ASN1 (x.RawData)); } // crls [1] IMPLICIT CertificateRevocationLists OPTIONAL, if (crls.Count > 0) { ASN1 a1 = signedData.Add (new ASN1 (0xA1)); foreach (byte[] crl in crls) a1.Add (new ASN1 (crl)); } // signerInfos SignerInfos -> SignerInfos ::= SET OF SignerInfo ASN1 signerInfos = signedData.Add (new ASN1 (0x31)); if (signerInfo.Key != null) signerInfos.Add (signerInfo.ASN1); return signedData; } public byte[] GetBytes () { return GetASN1 ().GetBytes (); } } /* * SignerInfo ::= SEQUENCE { * version Version, * issuerAndSerialNumber IssuerAndSerialNumber, * digestAlgorithm DigestAlgorithmIdentifier, * authenticatedAttributes [0] IMPLICIT Attributes OPTIONAL, * digestEncryptionAlgorithm DigestEncryptionAlgorithmIdentifier, * encryptedDigest EncryptedDigest, * unauthenticatedAttributes [1] IMPLICIT Attributes OPTIONAL * } * * For version == 3 issuerAndSerialNumber may be replaced by ... */ public class SignerInfo { private byte version; private X509Certificate x509; private string hashAlgorithm; private AsymmetricAlgorithm key; private ArrayList authenticatedAttributes; private ArrayList unauthenticatedAttributes; private byte[] signature; private string issuer; private byte[] serial; private byte[] ski; public SignerInfo () { version = 1; authenticatedAttributes = new ArrayList (); unauthenticatedAttributes = new ArrayList (); } public SignerInfo (byte[] data) : this (new ASN1 (data)) {} // TODO: INCOMPLETE public SignerInfo (ASN1 asn1) : this () { if ((asn1[0].Tag != 0x30) || (asn1[0].Count < 5)) throw new ArgumentException ("Invalid SignedData"); // version Version if (asn1[0][0].Tag != 0x02) throw new ArgumentException ("Invalid version"); version = asn1[0][0].Value[0]; // issuerAndSerialNumber IssuerAndSerialNumber ASN1 subjectIdentifierType = asn1 [0][1]; if ((subjectIdentifierType.Tag == 0x80) && (version == 3)) { ski = subjectIdentifierType.Value; } else { issuer = X501.ToString (subjectIdentifierType [0]); serial = subjectIdentifierType [1].Value; } // digestAlgorithm DigestAlgorithmIdentifier ASN1 digestAlgorithm = asn1 [0][2]; hashAlgorithm = ASN1Convert.ToOID (digestAlgorithm [0]); // authenticatedAttributes [0] IMPLICIT Attributes OPTIONAL int n = 3; ASN1 authAttributes = asn1 [0][n]; if (authAttributes.Tag == 0xA0) { n++; for (int i=0; i < authAttributes.Count; i++) authenticatedAttributes.Add (authAttributes [i]); } // digestEncryptionAlgorithm DigestEncryptionAlgorithmIdentifier ASN1 digestEncryptionAlgorithm = asn1 [0][n++]; string digestEncryptionAlgorithmOid = ASN1Convert.ToOID (digestEncryptionAlgorithm [0]); // encryptedDigest EncryptedDigest ASN1 encryptedDigest = asn1 [0][n++]; if (encryptedDigest.Tag == 0x04) signature = encryptedDigest.Value; // unauthenticatedAttributes [1] IMPLICIT Attributes OPTIONAL ASN1 unauthAttributes = asn1 [0][n]; if ((unauthAttributes != null) && (unauthAttributes.Tag == 0xA1)) { for (int i=0; i < unauthAttributes.Count; i++) unauthenticatedAttributes.Add (unauthAttributes [i]); } } public string IssuerName { get { return issuer; } } public byte[] SerialNumber { get { return (byte[]) serial.Clone (); } } public byte[] SubjectKeyIdentifier { get { return (byte[]) ski.Clone (); } } public ASN1 ASN1 { get { return GetASN1(); } } public ArrayList AuthenticatedAttributes { get { return authenticatedAttributes; } } public X509Certificate Certificate { get { return x509; } set { x509 = value; } } public string HashName { get { return hashAlgorithm; } set { hashAlgorithm = value; } } public AsymmetricAlgorithm Key { get { return key; } set { key = value; } } public byte[] Signature { get { return (byte[]) signature.Clone (); } } public ArrayList UnauthenticatedAttributes { get { return unauthenticatedAttributes; } } public byte Version { get { return version; } set { version = value; } } internal ASN1 GetASN1 () { if ((key == null) || (hashAlgorithm == null)) return null; byte[] ver = { version }; ASN1 signerInfo = new ASN1 (0x30); // version Version -> Version ::= INTEGER signerInfo.Add (new ASN1 (0x02, ver)); // issuerAndSerialNumber IssuerAndSerialNumber, signerInfo.Add (PKCS7.IssuerAndSerialNumber (x509)); // digestAlgorithm DigestAlgorithmIdentifier, string hashOid = CryptoConfig.MapNameToOID (hashAlgorithm); signerInfo.Add (AlgorithmIdentifier (hashOid)); // authenticatedAttributes [0] IMPLICIT Attributes OPTIONAL, ASN1 aa = signerInfo.Add (new ASN1 (0xA0)); if (authenticatedAttributes.Count > 0) { foreach (ASN1 attr in authenticatedAttributes) aa.Add (attr); } // digestEncryptionAlgorithm DigestEncryptionAlgorithmIdentifier, if (key is RSA) { signerInfo.Add (AlgorithmIdentifier (PKCS7.rsaEncryption)); RSAPKCS1SignatureFormatter r = new RSAPKCS1SignatureFormatter (key); r.SetHashAlgorithm (hashAlgorithm); byte[] tbs = aa.GetBytes (); tbs [0] = 0x31; // not 0xA0 for signature HashAlgorithm ha = HashAlgorithm.Create (hashAlgorithm); byte[] tbsHash = ha.ComputeHash (tbs); signature = r.CreateSignature (tbsHash); } else if (key is DSA) { throw new NotImplementedException ("not yet"); } else throw new CryptographicException ("Unknown assymetric algorithm"); // encryptedDigest EncryptedDigest, signerInfo.Add (new ASN1 (0x04, signature)); // unauthenticatedAttributes [1] IMPLICIT Attributes OPTIONAL if (unauthenticatedAttributes.Count > 0) { ASN1 ua = signerInfo.Add (new ASN1 (0xA1)); foreach (ASN1 attr in unauthenticatedAttributes) ua.Add (attr); } return signerInfo; } public byte[] GetBytes () { return GetASN1 ().GetBytes (); } } } } |
From: <car...@us...> - 2004-03-04 15:55:26
|
Update of /cvsroot/pgsqlclient/pgsqlclient_10/Mono.Security/Mono.Security/Mono.Security.Protocol.Tls.Handshake.Server In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv3214 Modified Files: TlsClientFinished.cs TlsClientHello.cs TlsClientKeyExchange.cs TlsServerCertificate.cs TlsServerFinished.cs TlsServerHello.cs TlsServerHelloDone.cs Log Message: Initial implementations Index: TlsClientFinished.cs =================================================================== RCS file: /cvsroot/pgsqlclient/pgsqlclient_10/Mono.Security/Mono.Security/Mono.Security.Protocol.Tls.Handshake.Server/TlsClientFinished.cs,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** TlsClientFinished.cs 3 Mar 2004 16:15:43 -0000 1.3 --- TlsClientFinished.cs 4 Mar 2004 15:41:55 -0000 1.4 *************** *** 54,63 **** protected override void ProcessAsSsl3() { ! throw new NotSupportedException(); } protected override void ProcessAsTls1() { ! throw new NotSupportedException(); } --- 54,109 ---- protected override void ProcessAsSsl3() { ! // Compute handshake messages hashes ! HashAlgorithm hash = new SslHandshakeHash(this.Context.MasterSecret); ! ! TlsStream data = new TlsStream(); ! data.Write(this.Context.HandshakeMessages.ToArray()); ! data.Write((int)0x434C4E54); ! ! hash.TransformFinalBlock(data.ToArray(), 0, (int)data.Length); ! ! data.Reset(); ! ! byte[] clientHash = this.ReadBytes((int)Length); ! byte[] serverHash = hash.Hash; ! ! // Check client prf against server prf ! if (clientHash.Length != serverHash.Length) ! { ! throw new TlsException("Invalid ServerFinished message received."); ! } ! for (int i = 0; i < clientHash.Length; i++) ! { ! if (clientHash[i] != serverHash[i]) ! { ! throw new TlsException("Invalid ServerFinished message received."); ! } ! } } protected override void ProcessAsTls1() { ! byte[] clientPRF = this.ReadBytes((int)this.Length); ! HashAlgorithm hash = new MD5SHA1(); ! ! hash.ComputeHash( ! this.Context.HandshakeMessages.ToArray(), ! 0, ! (int)this.Context.HandshakeMessages.Length); ! ! byte[] serverPRF = this.Context.Cipher.PRF(this.Context.MasterSecret, "client finished", hash.Hash, 12); ! ! // Check client prf against server prf ! if (clientPRF.Length != serverPRF.Length) ! { ! throw new TlsException("Invalid ServerFinished message received."); ! } ! for (int i = 0; i < serverPRF.Length; i++) ! { ! if (clientPRF[i] != serverPRF[i]) ! { ! throw new TlsException("Invalid ServerFinished message received."); ! } ! } } Index: TlsClientHello.cs =================================================================== RCS file: /cvsroot/pgsqlclient/pgsqlclient_10/Mono.Security/Mono.Security/Mono.Security.Protocol.Tls.Handshake.Server/TlsClientHello.cs,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** TlsClientHello.cs 3 Mar 2004 17:32:14 -0000 1.4 --- TlsClientHello.cs 4 Mar 2004 15:41:55 -0000 1.5 *************** *** 52,56 **** --- 52,63 ---- public override void Update() { + base.Update(); + this.selectCipherSuite(); + this.selectCompressionMethod(); + + this.Context.SessionId = this.sessionId; + this.Context.ClientRandom = this.random; + this.Context.ProtocolNegotiated = true; } *************** *** 124,128 **** if ((index = this.Context.SupportedCiphers.IndexOf(this.cipherSuites[i])) != -1) { ! this.Context.Cipher = this.Context.SupportedCiphers[index]; } } --- 131,135 ---- if ((index = this.Context.SupportedCiphers.IndexOf(this.cipherSuites[i])) != -1) { ! this.Context.Cipher = this.Context.SupportedCiphers[index]; } } Index: TlsClientKeyExchange.cs =================================================================== RCS file: /cvsroot/pgsqlclient/pgsqlclient_10/Mono.Security/Mono.Security/Mono.Security.Protocol.Tls.Handshake.Server/TlsClientKeyExchange.cs,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** TlsClientKeyExchange.cs 3 Mar 2004 16:15:43 -0000 1.3 --- TlsClientKeyExchange.cs 4 Mar 2004 15:41:55 -0000 1.4 *************** *** 51,55 **** protected override void ProcessAsTls1() { ! throw new NotSupportedException(); } --- 51,73 ---- protected override void ProcessAsTls1() { ! // Read client premaster secret ! byte[] clientSecret = this.ReadBytes(this.ReadInt16()); ! ! // Create a new RSA key ! RSA rsa = this.Context.Cipher.CertificateRSA(); ! ! // Decrypt premaster secret ! RSAPKCS1KeyExchangeDeformatter deformatter = new RSAPKCS1KeyExchangeDeformatter(rsa); ! ! byte[] preMasterSecret = deformatter.CreateKeyExchange(preMasterSecret); ! ! // Create master secret ! this.Context.Cipher.ComputeMasterSecret(preMasterSecret); ! ! // Create keys ! this.Context.Cipher.ComputeKeys(); ! ! // Clear resources ! rsa.Clear(); } Index: TlsServerCertificate.cs =================================================================== RCS file: /cvsroot/pgsqlclient/pgsqlclient_10/Mono.Security/Mono.Security/Mono.Security.Protocol.Tls.Handshake.Server/TlsServerCertificate.cs,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** TlsServerCertificate.cs 3 Mar 2004 16:21:19 -0000 1.4 --- TlsServerCertificate.cs 4 Mar 2004 15:41:55 -0000 1.5 *************** *** 44,66 **** #endregion - #region Methods - - public override void Update() - { - throw new NotSupportedException(); - } - - #endregion - #region Protected Methods protected override void ProcessAsSsl3() { ! throw new NotSupportedException(); } protected override void ProcessAsTls1() { ! throw new NotSupportedException(); } --- 44,71 ---- #endregion #region Protected Methods protected override void ProcessAsSsl3() { ! this.ProcessAsTls1(); } protected override void ProcessAsTls1() { ! TlsStream certs = new TlsStream(); ! ! foreach (X509Certificate certificate in this.Context.ServerSettings.Certificates) ! { ! // Write certificate length ! certs.WriteInt24(certificate.RawData.Length); ! ! // Write certificate data ! certs.Write(certificate.RawData); ! } ! ! this.WriteInt24(Convert.ToInt32(certs.Length)); ! this.Write(certs.ToArray()); ! ! certs.Close(); } Index: TlsServerFinished.cs =================================================================== RCS file: /cvsroot/pgsqlclient/pgsqlclient_10/Mono.Security/Mono.Security/Mono.Security.Protocol.Tls.Handshake.Server/TlsServerFinished.cs,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** TlsServerFinished.cs 3 Mar 2004 16:15:43 -0000 1.3 --- TlsServerFinished.cs 4 Mar 2004 15:41:55 -0000 1.4 *************** *** 54,63 **** protected override void ProcessAsSsl3() { ! throw new NotSupportedException(); } protected override void ProcessAsTls1() { ! throw new NotSupportedException(); } --- 54,82 ---- protected override void ProcessAsSsl3() { ! // Compute handshake messages hashes ! HashAlgorithm hash = new SslHandshakeHash(this.Context.MasterSecret); ! ! TlsStream data = new TlsStream(); ! data.Write(this.Context.HandshakeMessages.ToArray()); ! data.Write((int)0x53525652); ! ! hash.TransformFinalBlock(data.ToArray(), 0, (int)data.Length); ! ! this.Write(hash.Hash); ! ! data.Reset(); } protected override void ProcessAsTls1() { ! // Compute handshake messages hash ! HashAlgorithm hash = new MD5SHA1(); ! hash.ComputeHash( ! this.Context.HandshakeMessages.ToArray(), ! 0, ! (int)this.Context.HandshakeMessages.Length); ! ! // Write message ! this.Write(this.Context.Cipher.PRF(this.Context.MasterSecret, "server finished", hash.Hash, 12)); } Index: TlsServerHello.cs =================================================================== RCS file: /cvsroot/pgsqlclient/pgsqlclient_10/Mono.Security/Mono.Security/Mono.Security.Protocol.Tls.Handshake.Server/TlsServerHello.cs,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** TlsServerHello.cs 3 Mar 2004 16:15:43 -0000 1.3 --- TlsServerHello.cs 4 Mar 2004 15:41:55 -0000 1.4 *************** *** 29,32 **** --- 29,39 ---- internal class TlsServerHello : HandshakeMessage { + #region Private Fields + + private int unixTime; + private byte[] random; + + #endregion + #region Constructors *************** *** 42,46 **** public override void Update() { ! throw new NotSupportedException(); } --- 49,77 ---- public override void Update() { ! base.Update(); ! ! TlsStream random = new TlsStream(); ! ! // Compute Server Random ! random.Write(this.unixTime); ! random.Write(this.random); ! ! this.Context.ServerRandom = random.ToArray(); ! ! // Compute ClientRandom + ServerRandom ! random.Reset(); ! random.Write(this.Context.ClientRandom); ! random.Write(this.Context.ServerRandom); ! ! this.Context.RandomCS = random.ToArray(); ! ! // Server Random + Client Random ! random.Reset(); ! random.Write(this.Context.ServerRandom); ! random.Write(this.Context.ClientRandom); ! ! this.Context.RandomSC = random.ToArray(); ! ! random.Reset(); } *************** *** 51,60 **** protected override void ProcessAsSsl3() { ! throw new NotSupportedException(); } protected override void ProcessAsTls1() { ! throw new NotSupportedException(); } --- 82,119 ---- protected override void ProcessAsSsl3() { ! this.ProcessAsTls1(); } protected override void ProcessAsTls1() { ! // Write protocol version ! this.Write(this.Context.Protocol); ! ! // Write Unix time ! this.unixTime = this.Context.GetUnixTime(); ! this.Write(this.unixTime); ! ! // Write Random bytes ! random = this.Context.GetSecureRandomBytes(28); ! this.Write(this.random); ! ! if (this.Context.SessionId == null) ! { ! this.WriteByte(0); ! } ! else ! { ! // Write Session ID length ! this.WriteByte((byte)this.Context.SessionId.Length); ! ! // Write Session ID ! this.Write(this.Context.SessionId); ! } ! ! // Write selected cipher suite ! this.Write(this.Context.Cipher.Code); ! ! // Write selected compression method ! this.WriteByte((byte)this.Context.CompressionMethod); } Index: TlsServerHelloDone.cs =================================================================== RCS file: /cvsroot/pgsqlclient/pgsqlclient_10/Mono.Security/Mono.Security/Mono.Security.Protocol.Tls.Handshake.Server/TlsServerHelloDone.cs,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** TlsServerHelloDone.cs 3 Mar 2004 16:15:43 -0000 1.3 --- TlsServerHelloDone.cs 4 Mar 2004 15:41:55 -0000 1.4 *************** *** 32,46 **** public TlsServerHelloDone(Context context) ! : base(context, HandshakeType.ServerHello) ! { ! } ! ! #endregion ! ! #region Methods ! ! public override void Update() { - throw new NotSupportedException(); } --- 32,37 ---- public TlsServerHelloDone(Context context) ! : base(context, HandshakeType.ServerHelloDone) { } *************** *** 51,60 **** protected override void ProcessAsSsl3() { - throw new NotSupportedException(); } protected override void ProcessAsTls1() { - throw new NotSupportedException(); } --- 42,49 ---- |
From: <car...@us...> - 2004-03-04 15:54:44
|
Update of /cvsroot/pgsqlclient/pgsqlclient_10/Mono.Security/Mono.Security/Mono.Security.Protocol.Tls.Handshake.Client In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv3006 Modified Files: TlsServerHelloDone.cs Log Message: Updated file Index: TlsServerHelloDone.cs =================================================================== RCS file: /cvsroot/pgsqlclient/pgsqlclient_10/Mono.Security/Mono.Security/Mono.Security.Protocol.Tls.Handshake.Client/TlsServerHelloDone.cs,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** TlsServerHelloDone.cs 3 Mar 2004 16:14:40 -0000 1.3 --- TlsServerHelloDone.cs 4 Mar 2004 15:41:20 -0000 1.4 *************** *** 32,36 **** public TlsServerHelloDone(Context context, byte[] buffer) ! : base(context, HandshakeType.ServerHello, buffer) { } --- 32,36 ---- public TlsServerHelloDone(Context context, byte[] buffer) ! : base(context, HandshakeType.ServerHelloDone, buffer) { } |
From: <car...@us...> - 2004-03-04 15:53:54
|
Update of /cvsroot/pgsqlclient/pgsqlclient_10/Mono.Security/Mono.Security/Mono.Security.Protocol.Tls.Handshake.Client In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv2651 Modified Files: TlsServerHello.cs Log Message: Indentation change Index: TlsServerHello.cs =================================================================== RCS file: /cvsroot/pgsqlclient/pgsqlclient_10/Mono.Security/Mono.Security/Mono.Security.Protocol.Tls.Handshake.Client/TlsServerHello.cs,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** TlsServerHello.cs 3 Mar 2004 16:14:40 -0000 1.4 --- TlsServerHello.cs 4 Mar 2004 15:40:29 -0000 1.5 *************** *** 57,61 **** this.Context.Cipher = this.cipherSuite; this.Context.CompressionMethod = this.compressionMethod; - this.Context.Cipher.Context = this.Context; this.Context.ProtocolNegotiated = true; --- 57,60 ---- |
From: <car...@us...> - 2004-03-04 15:53:10
|
Update of /cvsroot/pgsqlclient/pgsqlclient_10/Mono.Security/Mono.Security/Mono.Security.Protocol.Tls.Handshake.Client In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv2466 Modified Files: TlsClientKeyExchange.cs Log Message: Indentation change Index: TlsClientKeyExchange.cs =================================================================== RCS file: /cvsroot/pgsqlclient/pgsqlclient_10/Mono.Security/Mono.Security/Mono.Security.Protocol.Tls.Handshake.Client/TlsClientKeyExchange.cs,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** TlsClientKeyExchange.cs 3 Mar 2004 16:14:40 -0000 1.3 --- TlsClientKeyExchange.cs 4 Mar 2004 15:39:45 -0000 1.4 *************** *** 34,39 **** public TlsClientKeyExchange (Context context) : ! base(context, ! HandshakeType.ClientKeyExchange) { } --- 34,38 ---- public TlsClientKeyExchange (Context context) : ! base(context, HandshakeType.ClientKeyExchange) { } |
From: <car...@us...> - 2004-03-04 15:52:35
|
Update of /cvsroot/pgsqlclient/pgsqlclient_10/Mono.Security/Mono.Security/Mono.Security.Protocol.Tls.Handshake.Client In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv2281 Modified Files: TlsClientHello.cs Log Message: Indentation change Index: TlsClientHello.cs =================================================================== RCS file: /cvsroot/pgsqlclient/pgsqlclient_10/Mono.Security/Mono.Security/Mono.Security.Protocol.Tls.Handshake.Client/TlsClientHello.cs,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** TlsClientHello.cs 3 Mar 2004 16:14:40 -0000 1.5 --- TlsClientHello.cs 4 Mar 2004 15:39:11 -0000 1.6 *************** *** 32,36 **** #region Fields ! private byte[] random; #endregion --- 32,36 ---- #region Fields ! private byte[] random; #endregion |
From: <car...@us...> - 2004-03-04 15:51:55
|
Update of /cvsroot/pgsqlclient/pgsqlclient_10/Mono.Security/Mono.Security/Mono.Security.Protocol.Tls.Handshake In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv2065 Modified Files: HandshakeType.cs Log Message: Updated file Index: HandshakeType.cs =================================================================== RCS file: /cvsroot/pgsqlclient/pgsqlclient_10/Mono.Security/Mono.Security/Mono.Security.Protocol.Tls.Handshake/HandshakeType.cs,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** HandshakeType.cs 3 Mar 2004 16:17:27 -0000 1.1 --- HandshakeType.cs 4 Mar 2004 15:38:26 -0000 1.2 *************** *** 40,43 **** --- 40,44 ---- ClientKeyExchange = 16, Finished = 20, + None = 255 } } |
From: <car...@us...> - 2004-03-04 15:51:28
|
Update of /cvsroot/pgsqlclient/pgsqlclient_10/Mono.Security/Mono.Security/Mono.Security.Protocol.Tls.Handshake In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv1901 Modified Files: HandshakeMessage.cs Log Message: Updated file Index: HandshakeMessage.cs =================================================================== RCS file: /cvsroot/pgsqlclient/pgsqlclient_10/Mono.Security/Mono.Security/Mono.Security.Protocol.Tls.Handshake/HandshakeMessage.cs,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** HandshakeMessage.cs 3 Mar 2004 16:17:27 -0000 1.1 --- HandshakeMessage.cs 4 Mar 2004 15:38:03 -0000 1.2 *************** *** 123,128 **** public virtual void Update() { - this.context.LastHandshakeMsg = this.handshakeType; - if (this.CanWrite) { --- 123,126 ---- |
From: <car...@us...> - 2004-03-03 17:45:30
|
Update of /cvsroot/pgsqlclient/pgsqlclient_10/Mono.Security In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv2803 Modified Files: changelog.txt Log Message: 2004-03-03 Carlos Guzman Alvarez <car...@te...> * Mono.Security.Protocol.Tls.Handshake.Server/TlsClientHello.cs: - Initial implementation ( not finished ) Index: changelog.txt =================================================================== RCS file: /cvsroot/pgsqlclient/pgsqlclient_10/Mono.Security/changelog.txt,v retrieving revision 1.15 retrieving revision 1.16 diff -C2 -d -r1.15 -r1.16 *** changelog.txt 3 Mar 2004 16:24:10 -0000 1.15 --- changelog.txt 3 Mar 2004 17:32:46 -0000 1.16 *************** *** 4,7 **** --- 4,11 ---- 2004-03-03 Carlos Guzman Alvarez <car...@te...> + * Mono.Security.Protocol.Tls.Handshake.Server/TlsClientHello.cs: + + - Initial implementation ( not finished ) + * Mono.Security.Protocol.Tls/SslServerStream.cs: |
From: <car...@us...> - 2004-03-03 17:44:56
|
Update of /cvsroot/pgsqlclient/pgsqlclient_10/Mono.Security/Mono.Security/Mono.Security.Protocol.Tls.Handshake.Server In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv2699 Modified Files: TlsClientHello.cs Log Message: 2004-03-03 Carlos Guzman Alvarez <car...@te...> * Mono.Security.Protocol.Tls.Handshake.Server/TlsClientHello.cs: - Initial implementation ( not finished ) Index: TlsClientHello.cs =================================================================== RCS file: /cvsroot/pgsqlclient/pgsqlclient_10/Mono.Security/Mono.Security/Mono.Security.Protocol.Tls.Handshake.Server/TlsClientHello.cs,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** TlsClientHello.cs 3 Mar 2004 16:15:43 -0000 1.3 --- TlsClientHello.cs 3 Mar 2004 17:32:14 -0000 1.4 *************** *** 30,33 **** --- 30,42 ---- internal class TlsClientHello : HandshakeMessage { + #region Private Fields + + private byte[] random; + private byte[] sessionId; + private short[] cipherSuites; + private byte[] compressionMethods; + + #endregion + #region Constructors *************** *** 43,47 **** public override void Update() { ! throw new NotSupportedException(); } --- 52,56 ---- public override void Update() { ! this.selectCipherSuite(); } *************** *** 57,61 **** protected override void ProcessAsTls1() { ! throw new NotSupportedException(); } --- 66,140 ---- protected override void ProcessAsTls1() { ! // Client Version ! this.processProtocol(this.ReadInt16()); ! ! // Random bytes - Unix time + Radom bytes [28] ! this.random = this.ReadBytes(32); ! ! // Session id ! // Send the session ID empty ! byte[] sessionId = this.ReadBytes(this.ReadByte()); ! ! // Read Supported Cipher Suites count ! this.cipherSuites = new short[this.ReadInt16()/2]; ! ! // Read Cipher Suites ! for (int i = 0; i < this.cipherSuites.Length; i++) ! { ! this.cipherSuites[i] = this.ReadInt16(); ! } ! ! // Compression methods length ! this.compressionMethods = new byte[this.ReadByte()]; ! ! for (int i = 0; i < this.compressionMethods.Length; i++) ! { ! this.compressionMethods[i] = this.ReadByte(); ! } ! } ! ! #endregion ! ! #region Private Methods ! ! private void processProtocol(short protocol) ! { ! SecurityProtocolType clientProtocol = this.Context.DecodeProtocolCode(protocol); ! ! if ((clientProtocol & this.Context.SecurityProtocolFlags) == clientProtocol || ! (this.Context.SecurityProtocolFlags & SecurityProtocolType.Default) == SecurityProtocolType.Default) ! { ! this.Context.SecurityProtocol = clientProtocol; ! this.Context.SupportedCiphers.Clear(); ! this.Context.SupportedCiphers = null; ! this.Context.SupportedCiphers = CipherSuiteFactory.GetSupportedCiphers(clientProtocol); ! } ! else ! { ! #warning "Send alert" ! throw this.Context.CreateException("Incorrect protocol version received from server"); ! } ! } ! ! private void selectCipherSuite() ! { ! int index = 0; ! for (int i = 0; i < this.cipherSuites.Length; i++) ! { ! if ((index = this.Context.SupportedCiphers.IndexOf(this.cipherSuites[i])) != -1) ! { ! this.Context.Cipher = this.Context.SupportedCiphers[index]; ! } ! } ! ! if (this.Context.Cipher == null) ! { ! #warning "Send an Alert and Throw and exception" ! } ! } ! ! private void selectCompressionMethod() ! { ! this.Context.CompressionMethod = SecurityCompressionType.None; } |
From: <car...@us...> - 2004-03-03 16:38:45
|
Update of /cvsroot/pgsqlclient/pgsqlclient_10/PostgreSql.Data.PgSqlClient.UnitTests In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv20679 Modified Files: PostgreSql.Data.PgSqlClient.UnitTests.dll.config 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 ) Index: PostgreSql.Data.PgSqlClient.UnitTests.dll.config =================================================================== RCS file: /cvsroot/pgsqlclient/pgsqlclient_10/PostgreSql.Data.PgSqlClient.UnitTests/PostgreSql.Data.PgSqlClient.UnitTests.dll.config,v retrieving revision 1.1.1.1 retrieving revision 1.2 diff -C2 -d -r1.1.1.1 -r1.2 *** PostgreSql.Data.PgSqlClient.UnitTests.dll.config 2 Aug 2003 19:43:03 -0000 1.1.1.1 --- PostgreSql.Data.PgSqlClient.UnitTests.dll.config 3 Mar 2004 16:26:06 -0000 1.2 *************** *** 10,13 **** --- 10,14 ---- <add key="Pooling" value="false" /> <add key="Packet Size" value="8192" /> + <add key="SSL" value="false" /> </appSettings> </configuration> \ No newline at end of file |
From: <car...@us...> - 2004-03-03 16:38:07
|
Update of /cvsroot/pgsqlclient/pgsqlclient_10/PostgreSql.Data.PgSqlClient/source/NPgClient In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv20552 Modified Files: PgDbClient.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 ) Index: PgDbClient.cs =================================================================== RCS file: /cvsroot/pgsqlclient/pgsqlclient_10/PostgreSql.Data.PgSqlClient/source/NPgClient/PgDbClient.cs,v retrieving revision 1.42 retrieving revision 1.43 diff -C2 -d -r1.42 -r1.43 *** PgDbClient.cs 15 Feb 2004 00:17:52 -0000 1.42 --- PgDbClient.cs 3 Mar 2004 16:25:27 -0000 1.43 *************** *** 26,30 **** using Mono.Security.Protocol.Tls; - using Mono.Security.Protocol.Tls.Alerts; namespace PostgreSql.Data.NPgClient --- 26,29 ---- |
From: <car...@us...> - 2004-03-03 16:37:44
|
Update of /cvsroot/pgsqlclient/pgsqlclient_10 In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv20371 Modified Files: changelog.txt 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 ) Index: changelog.txt =================================================================== RCS file: /cvsroot/pgsqlclient/pgsqlclient_10/changelog.txt,v retrieving revision 1.98 retrieving revision 1.99 diff -C2 -d -r1.98 -r1.99 *** changelog.txt 25 Feb 2004 15:43:43 -0000 1.98 --- changelog.txt 3 Mar 2004 16:24:49 -0000 1.99 *************** *** 2,5 **** --- 2,60 ---- ------------------------------------------------------- + 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 ) + 2004-02-25 Carlos Guzman Alvarez <car...@te...> |
From: <car...@us...> - 2004-03-03 16:36:50
|
Update of /cvsroot/pgsqlclient/pgsqlclient_10/Mono.Security In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv20150 Modified Files: changelog.txt 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 ) Index: changelog.txt =================================================================== RCS file: /cvsroot/pgsqlclient/pgsqlclient_10/Mono.Security/changelog.txt,v retrieving revision 1.14 retrieving revision 1.15 diff -C2 -d -r1.14 -r1.15 *** changelog.txt 25 Feb 2004 15:43:09 -0000 1.14 --- changelog.txt 3 Mar 2004 16:24:10 -0000 1.15 *************** *** 2,5 **** --- 2,60 ---- --------------- ----------- ----------------------------------------- + 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 ) + 2004-02-25 Carlos Guzman Alvarez <car...@te...> |
Update of /cvsroot/pgsqlclient/pgsqlclient_10/Mono.Security/Mono.Security/Mono.Security.Protocol.Tls In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv19625 Modified Files: CipherSuite.cs ClientContext.cs ClientRecordProtocol.cs Context.cs RecordProtocol.cs ServerRecordProtocol.cs SslClientStream.cs SslServerStream.cs TlsCipherSuite.cs TlsException.cs TlsServerSettings.cs Added Files: Alert.cs CipherSuiteCollection.cs CipherSuiteFactory.cs ContentType.cs SslCipherSuite.cs SslHandshakeHash.cs Removed Files: TlsCipherSuiteCollection.cs TlsCipherSuiteFactory.cs TlsContentType.cs TlsSslCipherSuite.cs TlsSslHandshakeHash.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: Alert.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; using Mono.Security.Protocol.Tls; namespace Mono.Security.Protocol.Tls { #region Enumerations [Serializable] internal enum AlertLevel : byte { Warning = 1, Fatal = 2 } [Serializable] internal enum AlertDescription : byte { CloseNotify = 0, UnexpectedMessage = 10, BadRecordMAC = 20, DecryptionFailed = 21, RecordOverflow = 22, DecompressionFailiure = 30, HandshakeFailiure = 40, BadCertificate = 42, UnsupportedCertificate = 43, CertificateRevoked = 44, CertificateExpired = 45, CertificateUnknown = 46, IlegalParameter = 47, UnknownCA = 48, AccessDenied = 49, DecodeError = 50, DecryptError = 51, ExportRestriction = 60, ProtocolVersion = 70, InsuficientSecurity = 71, InternalError = 80, UserCancelled = 90, NoRenegotiation = 100 } #endregion internal class Alert : TlsStream { #region Fields private Context context; private AlertLevel level; private AlertDescription description; #endregion #region Constructors public Alert( Context context, AlertDescription description) : base() { this.context = context; this.description = description; this.inferAlertLevel(); this.fill(); } public Alert( Context context, AlertLevel level, AlertDescription description) : base() { this.context = context; this.level = level; this.description = description; this.fill(); } #endregion #region Properties public string Message { get { return Alert.GetAlertMessage(this.description); } } public bool IsWarning { get { return this.level == AlertLevel.Warning ? true : false; } } public bool IsFatal { get { return this.level == AlertLevel.Fatal ? true : false; } } public bool IsCloseNotify { get { if (this.IsWarning && this.description == AlertDescription.CloseNotify) { return true; } return false; } } #endregion #region Methods public void Update() { if ( this.description == AlertDescription.CloseNotify ) { this.context.ConnectionEnd = true; } if (this.IsFatal) { this.context.ConnectionEnd = true; if (this.context is ServerContext) { ((ServerContext)this.context).SslStream.Close(); } } } #endregion #region Private Methods private void fill() { this.Write((byte)level); this.Write((byte)description); } private void inferAlertLevel() { switch (description) { case AlertDescription.CloseNotify: case AlertDescription.NoRenegotiation: case AlertDescription.UserCancelled: this.level = AlertLevel.Warning; break; case AlertDescription.AccessDenied: case AlertDescription.BadCertificate: case AlertDescription.BadRecordMAC: case AlertDescription.CertificateExpired: case AlertDescription.CertificateRevoked: case AlertDescription.CertificateUnknown: case AlertDescription.DecodeError: case AlertDescription.DecompressionFailiure: case AlertDescription.DecryptError: case AlertDescription.DecryptionFailed: case AlertDescription.ExportRestriction: case AlertDescription.HandshakeFailiure: case AlertDescription.IlegalParameter: case AlertDescription.InsuficientSecurity: case AlertDescription.InternalError: case AlertDescription.ProtocolVersion: case AlertDescription.RecordOverflow: case AlertDescription.UnexpectedMessage: case AlertDescription.UnknownCA: case AlertDescription.UnsupportedCertificate: default: this.level = AlertLevel.Fatal; break; } } #endregion #region Static Methods public static string GetAlertMessage(AlertDescription description) { #if (DEBUG) switch (description) { case AlertDescription.AccessDenied: return "An inappropriate message was received."; case AlertDescription.BadCertificate: return "TLSCiphertext decrypted in an invalid way."; case AlertDescription.BadRecordMAC: return "Record with an incorrect MAC."; case AlertDescription.CertificateExpired: return "Certificate has expired or is not currently valid"; case AlertDescription.CertificateRevoked: return "Certificate was revoked by its signer."; case AlertDescription.CertificateUnknown: return "Certificate Unknown."; case AlertDescription.CloseNotify: return "Connection closed"; case AlertDescription.DecodeError: return "A message could not be decoded because some field was out of the specified range or the length of the message was incorrect."; case AlertDescription.DecompressionFailiure: return "The decompression function received improper input (e.g. data that would expand to excessive length)."; case AlertDescription.DecryptError: return "TLSCiphertext decrypted in an invalid way: either it wasn`t an even multiple of the block length or its padding values, when checked, weren`t correct."; case AlertDescription.DecryptionFailed: return "Handshake cryptographic operation failed, including being unable to correctly verify a signature, decrypt a key exchange, or validate finished message."; case AlertDescription.ExportRestriction: return "Negotiation not in compliance with export restrictions was detected."; case AlertDescription.HandshakeFailiure: return "Unable to negotiate an acceptable set of security parameters given the options available."; case AlertDescription.IlegalParameter: return "A field in the handshake was out of range or inconsistent with other fields."; case AlertDescription.InsuficientSecurity: return "Negotiation has failed specifically because the server requires ciphers more secure than those supported by the client."; case AlertDescription.InternalError: return "Internal error unrelated to the peer or the correctness of the protocol makes it impossible to continue."; case AlertDescription.NoRenegotiation: return "Invalid renegotiation."; case AlertDescription.ProtocolVersion: return "Unsupported protocol version."; case AlertDescription.RecordOverflow: return "Invalid length on TLSCiphertext record or TLSCompressed record."; case AlertDescription.UnexpectedMessage: return "Invalid message received."; case AlertDescription.UnknownCA: return "CA can't be identified as a trusted CA."; case AlertDescription.UnsupportedCertificate: return "Certificate was of an unsupported type."; case AlertDescription.UserCancelled: return "Handshake cancelled by user."; default: return ""; } #else return "The authentication or decryption has failed."; #endif } #endregion } } --- NEW FILE: CipherSuiteCollection.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; using System.Collections; using System.Globalization; using System.Security.Cryptography; namespace Mono.Security.Protocol.Tls { internal sealed class CipherSuiteCollection : 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 CipherSuiteCollection(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.Default: case SecurityProtocolType.Tls: return this.add( new TlsCipherSuite( code, name, cipherType, hashType, exchangeType, exportable, blockMode, keyMaterialSize, expandedKeyMaterialSize, effectiveKeyBytes, ivSize, blockSize)); case SecurityProtocolType.Ssl3: return this.add( new SslCipherSuite( code, name, cipherType, hashType, exchangeType, exportable, blockMode, keyMaterialSize, expandedKeyMaterialSize, effectiveKeyBytes, ivSize, blockSize)); case SecurityProtocolType.Ssl2: default: throw new NotSupportedException("Unsupported security protocol type."); } } private TlsCipherSuite add(TlsCipherSuite cipherSuite) { base.Add(cipherSuite); return cipherSuite; } private SslCipherSuite add(SslCipherSuite 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 } } --- NEW FILE: CipherSuiteFactory.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 { internal class CipherSuiteFactory { public static CipherSuiteCollection GetSupportedCiphers(SecurityProtocolType protocol) { switch (protocol) { case SecurityProtocolType.Default: case SecurityProtocolType.Tls: return CipherSuiteFactory.GetTls1SupportedCiphers(); case SecurityProtocolType.Ssl3: return CipherSuiteFactory.GetSsl3SupportedCiphers(); case SecurityProtocolType.Ssl2: default: throw new NotSupportedException("Unsupported security protocol type"); } } #region Private Static Methods private static CipherSuiteCollection GetTls1SupportedCiphers() { CipherSuiteCollection scs = new CipherSuiteCollection(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) | 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) | 0x09, "TLS_RSA_WITH_DES_CBC_SHA", CipherAlgorithmType.Des, HashAlgorithmType.Sha1, ExchangeAlgorithmType.RsaSign, false, true, 8, 8, 56, 8, 8); // 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.RsaKeyX, 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 CipherSuiteCollection GetSsl3SupportedCiphers() { CipherSuiteCollection scs = new CipherSuiteCollection(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) | 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) | 0x09, "SSL_RSA_WITH_DES_CBC_SHA", CipherAlgorithmType.Des, HashAlgorithmType.Sha1, ExchangeAlgorithmType.RsaSign, false, true, 8, 8, 56, 8, 8); // 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 } } --- NEW FILE: ContentType.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 { [Serializable] internal enum ContentType : byte { ChangeCipherSpec = 20, Alert = 21, Handshake = 22, ApplicationData = 23, } } --- NEW FILE: SslCipherSuite.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; 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 SslCipherSuite : CipherSuite { #region Fields private byte[] pad1; private byte[] pad2; #endregion #region Constructors public SslCipherSuite( 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) { int padLength = (hashAlgorithmType == HashAlgorithmType.Md5) ? 48 : 40; // Fill pad arrays this.pad1 = new byte[padLength]; this.pad2 = new byte[padLength]; /* Pad the key for inner and outer digest */ for (int i = 0; i < padLength; ++i) { pad1[i] = 0x36; pad2[i] = 0x5C; } } #endregion #region MAC Generation Methods public override byte[] ComputeServerRecordMAC(ContentType contentType, byte[] fragment) { HashAlgorithm hash = HashAlgorithm.Create(this.HashAlgorithmName); TlsStream block = new TlsStream(); block.Write(this.Context.ServerWriteMAC); block.Write(this.pad1); block.Write(this.Context.ReadSequenceNumber); block.Write((byte)contentType); block.Write((short)fragment.Length); block.Write(fragment); hash.ComputeHash(block.ToArray(), 0, (int)block.Length); byte[] blockHash = hash.Hash; block.Reset(); block.Write(this.Context.ServerWriteMAC); block.Write(this.pad2); block.Write(blockHash); hash.ComputeHash(block.ToArray(), 0, (int)block.Length); block.Reset(); return hash.Hash; } public override byte[] ComputeClientRecordMAC(ContentType contentType, byte[] fragment) { HashAlgorithm hash = HashAlgorithm.Create(this.HashAlgorithmName); TlsStream block = new TlsStream(); block.Write(this.Context.ClientWriteMAC); block.Write(this.pad1); block.Write(this.Context.WriteSequenceNumber); block.Write((byte)contentType); block.Write((short)fragment.Length); block.Write(fragment); hash.ComputeHash(block.ToArray(), 0, (int)block.Length); byte[] blockHash = hash.Hash; block.Reset(); block.Write(this.Context.ClientWriteMAC); block.Write(this.pad2); block.Write(blockHash); hash.ComputeHash(block.ToArray(), 0, (int)block.Length); block.Reset(); return hash.Hash; } #endregion #region Key Generation Methods public override void ComputeMasterSecret(byte[] preMasterSecret) { TlsStream masterSecret = new TlsStream(); masterSecret.Write(this.prf(preMasterSecret, "A", this.Context.RandomCS)); masterSecret.Write(this.prf(preMasterSecret, "BB", this.Context.RandomCS)); masterSecret.Write(this.prf(preMasterSecret, "CCC", this.Context.RandomCS)); this.Context.MasterSecret = masterSecret.ToArray(); } public override void ComputeKeys() { // Compute KeyBlock TlsStream tmp = new TlsStream(); char labelChar = 'A'; int count = 1; while (tmp.Length < this.KeyBlockSize) { string label = String.Empty; for (int i = 0; i < count; i++) { label += labelChar.ToString(); } byte[] block = this.prf(this.Context.MasterSecret, label.ToString(), this.Context.RandomSC); int size = (tmp.Length + block.Length) > this.KeyBlockSize ? (this.KeyBlockSize - (int)tmp.Length) : block.Length; tmp.Write(block, 0, size); labelChar++; count++; } // Create keyblock TlsStream keyBlock = new TlsStream(tmp.ToArray()); 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 = CipherSuite.EmptyArray; this.Context.ServerWriteIV = CipherSuite.EmptyArray; } } else { HashAlgorithm md5 = MD5.Create(); // Generate final write keys byte[] finalClientWriteKey = new byte[md5.HashSize]; md5.TransformBlock(this.Context.ClientWriteKey, 0, this.Context.ClientWriteKey.Length, finalClientWriteKey, 0); finalClientWriteKey = md5.TransformFinalBlock(this.Context.RandomCS, 0, this.Context.RandomCS.Length); byte[] finalServerWriteKey = new byte[md5.HashSize]; md5.TransformBlock(this.Context.ServerWriteKey, 0, this.Context.ServerWriteKey.Length, finalServerWriteKey, 0); finalClientWriteKey = md5.TransformFinalBlock(this.Context.RandomSC, 0, this.Context.RandomSC.Length); this.Context.ClientWriteKey = finalClientWriteKey; this.Context.ServerWriteKey = finalServerWriteKey; // Generate IV keys this.Context.ClientWriteIV = md5.TransformFinalBlock(this.Context.RandomCS, 0, this.Context.RandomCS.Length); this.Context.ServerWriteIV = md5.TransformFinalBlock(this.Context.RandomSC, 0, this.Context.RandomSC.Length); } // Clear no more needed data keyBlock.Reset(); tmp.Reset(); } #endregion #region Private Methods private byte[] prf(byte[] secret, string label, byte[] random) { HashAlgorithm md5 = MD5.Create(); HashAlgorithm sha = SHA1.Create(); // Compute SHA hash TlsStream block = new TlsStream(); block.Write(Encoding.ASCII.GetBytes(label)); block.Write(secret); block.Write(random); byte[] shaHash = sha.ComputeHash(block.ToArray(), 0, (int)block.Length); block.Reset(); // Compute MD5 hash block.Write(secret); block.Write(shaHash); byte[] result = md5.ComputeHash(block.ToArray(), 0, (int)block.Length); // Free resources block.Reset(); return result; } #endregion } } --- NEW FILE: SslHandshakeHash.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; using System.Security.Cryptography; namespace Mono.Security.Protocol.Tls { internal class SslHandshakeHash : System.Security.Cryptography.HashAlgorithm { #region Fields private HashAlgorithm md5; private HashAlgorithm sha; private bool hashing; private byte[] secret; private byte[] innerPadMD5; private byte[] outerPadMD5; private byte[] innerPadSHA; private byte[] outerPadSHA; #endregion #region Constructors public SslHandshakeHash(byte[] secret) { // Create md5 and sha1 hashes this.md5 = HashAlgorithm.Create("MD5"); this.sha = HashAlgorithm.Create("SHA1"); // Set HashSizeValue this.HashSizeValue = md5.HashSize + sha.HashSize; // Update secret this.secret = secret; this.Initialize(); } #endregion #region Methods public override void Initialize() { md5.Initialize(); sha.Initialize(); initializePad(); hashing = false; } protected override byte[] HashFinal() { if (!hashing) { hashing = true; } // Finalize the md5 hash md5.TransformBlock(this.secret, 0, this.secret.Length, this.secret, 0); md5.TransformFinalBlock(this.innerPadMD5, 0, this.innerPadMD5.Length); byte[] firstResultMD5 = md5.Hash; md5.Initialize(); md5.TransformBlock(this.secret, 0, this.secret.Length, this.secret, 0); md5.TransformBlock(this.outerPadMD5, 0, this.outerPadMD5.Length, this.outerPadMD5, 0); md5.TransformFinalBlock(firstResultMD5, 0, firstResultMD5.Length); // Finalize the sha1 hash sha.TransformBlock(this.secret, 0, this.secret.Length, this.secret, 0); sha.TransformFinalBlock(this.innerPadSHA, 0, this.innerPadSHA.Length); byte[] firstResultSHA = sha.Hash; sha.Initialize(); sha.TransformBlock(this.secret, 0, this.secret.Length, this.secret, 0); sha.TransformBlock(this.outerPadSHA, 0, this.outerPadSHA.Length, this.outerPadSHA, 0); sha.TransformFinalBlock(firstResultSHA, 0, firstResultSHA.Length); this.Initialize(); byte[] result = new byte[36]; System.Array.Copy(md5.Hash, 0, result, 0, 16); System.Array.Copy(sha.Hash, 0, result, 16, 20); return result; } protected override void HashCore( byte[] array, int ibStart, int cbSize) { if (!hashing) { hashing = true; } md5.TransformBlock(array, ibStart, cbSize, array, ibStart); sha.TransformBlock(array, ibStart, cbSize, array, ibStart); } #endregion #region Private Methods private void initializePad() { // Fill md5 arrays this.innerPadMD5 = new byte[48]; this.outerPadMD5 = new byte[48]; /* Pad the key for inner and outer digest */ for (int i = 0; i < 48; ++i) { this.innerPadMD5[i] = 0x36; this.outerPadMD5[i] = 0x5C; } // Fill sha arrays this.innerPadSHA = new byte[40]; this.outerPadSHA = new byte[40]; /* Pad the key for inner and outer digest */ for (int i = 0; i < 40; ++i) { this.innerPadSHA[i] = 0x36; this.outerPadSHA[i] = 0x5C; } } #endregion } } Index: CipherSuite.cs =================================================================== RCS file: /cvsroot/pgsqlclient/pgsqlclient_10/Mono.Security/Mono.Security/Mono.Security.Protocol.Tls/CipherSuite.cs,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** CipherSuite.cs 23 Feb 2004 12:15:58 -0000 1.5 --- CipherSuite.cs 3 Mar 2004 16:22:36 -0000 1.6 *************** *** 339,345 **** #region Abstract Methods ! public abstract byte[] ComputeClientRecordMAC(TlsContentType contentType, byte[] fragment); ! public abstract byte[] ComputeServerRecordMAC(TlsContentType contentType, byte[] fragment); public abstract void ComputeMasterSecret(byte[] preMasterSecret); --- 339,345 ---- #region Abstract Methods ! public abstract byte[] ComputeClientRecordMAC(ContentType contentType, byte[] fragment); ! public abstract byte[] ComputeServerRecordMAC(ContentType contentType, byte[] fragment); public abstract void ComputeMasterSecret(byte[] preMasterSecret); Index: ClientContext.cs =================================================================== RCS file: /cvsroot/pgsqlclient/pgsqlclient_10/Mono.Security/Mono.Security/Mono.Security.Protocol.Tls/ClientContext.cs,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** ClientContext.cs 25 Feb 2004 15:39:33 -0000 1.2 --- ClientContext.cs 3 Mar 2004 16:22:36 -0000 1.3 *************** *** 36,40 **** private SslClientStream sslStream; private short clientHelloProtocol; - private bool helloDone; #endregion --- 36,39 ---- *************** *** 47,56 **** } - public bool HelloDone - { - get { return helloDone; } - set { helloDone = value; } - } - public short ClientHelloProtocol { --- 46,49 ---- *************** *** 81,85 **** public override void Clear() { - this.helloDone = false; this.clientHelloProtocol = 0; --- 74,77 ---- Index: ClientRecordProtocol.cs =================================================================== RCS file: /cvsroot/pgsqlclient/pgsqlclient_10/Mono.Security/Mono.Security/Mono.Security.Protocol.Tls/ClientRecordProtocol.cs,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** ClientRecordProtocol.cs 25 Feb 2004 15:39:33 -0000 1.3 --- ClientRecordProtocol.cs 3 Mar 2004 16:22:36 -0000 1.4 *************** *** 26,30 **** using System.IO; - using Mono.Security.Protocol.Tls.Alerts; using Mono.Security.Protocol.Tls.Handshake; using Mono.Security.Protocol.Tls.Handshake.Client; --- 26,29 ---- *************** *** 46,53 **** #region Send Messages ! public override void SendRecord(TlsHandshakeType type) { // Create the record message ! TlsHandshakeMessage msg = this.createClientHandshakeMessage(type); // Write record --- 45,52 ---- #region Send Messages ! public override void SendRecord(HandshakeType type) { // Create the record message ! HandshakeMessage msg = this.createClientHandshakeMessage(type); // Write record *************** *** 67,72 **** protected override void ProcessHandshakeMessage(TlsStream handMsg) { ! TlsHandshakeType handshakeType = (TlsHandshakeType)handMsg.ReadByte(); ! TlsHandshakeMessage message = null; // Read message length --- 66,71 ---- protected override void ProcessHandshakeMessage(TlsStream handMsg) { ! HandshakeType handshakeType = (HandshakeType)handMsg.ReadByte(); ! HandshakeMessage message = null; // Read message length *************** *** 91,112 **** #region Client Handshake Message Factories ! private TlsHandshakeMessage createClientHandshakeMessage( ! TlsHandshakeType type) { switch (type) { ! case TlsHandshakeType.ClientHello: return new TlsClientHello(this.context); ! case TlsHandshakeType.Certificate: return new TlsClientCertificate(this.context); ! case TlsHandshakeType.ClientKeyExchange: return new TlsClientKeyExchange(this.context); ! case TlsHandshakeType.CertificateVerify: return new TlsClientCertificateVerify(this.context); ! case TlsHandshakeType.Finished: return new TlsClientFinished(this.context); --- 90,111 ---- #region Client Handshake Message Factories ! private HandshakeMessage createClientHandshakeMessage( ! HandshakeType type) { switch (type) { ! case HandshakeType.ClientHello: return new TlsClientHello(this.context); ! case HandshakeType.Certificate: return new TlsClientCertificate(this.context); ! case HandshakeType.ClientKeyExchange: return new TlsClientKeyExchange(this.context); ! case HandshakeType.CertificateVerify: return new TlsClientCertificateVerify(this.context); ! case HandshakeType.Finished: return new TlsClientFinished(this.context); *************** *** 116,121 **** } ! private TlsHandshakeMessage createServerHandshakeMessage( ! TlsHandshakeType type, byte[] buffer) { ClientContext context = (ClientContext)this.context; --- 115,120 ---- } ! private HandshakeMessage createServerHandshakeMessage( ! HandshakeType type, byte[] buffer) { ClientContext context = (ClientContext)this.context; *************** *** 123,127 **** switch (type) { ! case TlsHandshakeType.HelloRequest: if (context.HandshakeState != HandshakeState.Started) { --- 122,126 ---- switch (type) { ! case HandshakeType.HelloRequest: if (context.HandshakeState != HandshakeState.Started) { *************** *** 131,155 **** { this.SendAlert( ! TlsAlertLevel.Warning, ! TlsAlertDescription.NoRenegotiation); } return null; ! case TlsHandshakeType.ServerHello: return new TlsServerHello(this.context, buffer); ! case TlsHandshakeType.Certificate: return new TlsServerCertificate(this.context, buffer); ! case TlsHandshakeType.ServerKeyExchange: return new TlsServerKeyExchange(this.context, buffer); ! case TlsHandshakeType.CertificateRequest: return new TlsServerCertificateRequest(this.context, buffer); ! case TlsHandshakeType.ServerHelloDone: return new TlsServerHelloDone(this.context, buffer); ! case TlsHandshakeType.Finished: return new TlsServerFinished(this.context, buffer); --- 130,154 ---- { this.SendAlert( ! AlertLevel.Warning, ! AlertDescription.NoRenegotiation); } return null; ! case HandshakeType.ServerHello: return new TlsServerHello(this.context, buffer); ! case HandshakeType.Certificate: return new TlsServerCertificate(this.context, buffer); ! case HandshakeType.ServerKeyExchange: return new TlsServerKeyExchange(this.context, buffer); ! case HandshakeType.CertificateRequest: return new TlsServerCertificateRequest(this.context, buffer); ! case HandshakeType.ServerHelloDone: return new TlsServerHelloDone(this.context, buffer); ! case HandshakeType.Finished: return new TlsServerFinished(this.context, buffer); Index: Context.cs =================================================================== RCS file: /cvsroot/pgsqlclient/pgsqlclient_10/Mono.Security/Mono.Security/Mono.Security.Protocol.Tls/Context.cs,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** Context.cs 25 Feb 2004 15:39:33 -0000 1.2 --- Context.cs 3 Mar 2004 16:22:36 -0000 1.3 *************** *** 30,34 **** using Mono.Security.Cryptography; - using Mono.Security.Protocol.Tls.Alerts; using Mono.Security.Protocol.Tls.Handshake; --- 30,33 ---- *************** *** 64,69 **** // Cipher suite information ! private CipherSuite cipher; ! private TlsCipherSuiteCollection supportedCiphers; // Handshake negotiation state --- 63,71 ---- // Cipher suite information ! private CipherSuite cipher; ! private CipherSuiteCollection supportedCiphers; ! ! // Last handshake message received ! private HandshakeType lastHandshakeMsg; // Handshake negotiation state *************** *** 188,194 **** } public HandshakeState HandshakeState { ! get { return this.HandshakeState; } set { this.handshakeState = value; } } --- 190,202 ---- } + public HandshakeType LastHandshakeMsg + { + get { return this.lastHandshakeMsg; } + set { this.lastHandshakeMsg = value; } + } + public HandshakeState HandshakeState { ! get { return this.handshakeState; } set { this.handshakeState = value; } } *************** *** 206,210 **** } ! public TlsCipherSuiteCollection SupportedCiphers { get { return supportedCiphers; } --- 214,218 ---- } ! public CipherSuiteCollection SupportedCiphers { get { return supportedCiphers; } *************** *** 392,398 **** #region Exception Methods ! public TlsException CreateException(TlsAlertLevel alertLevel, TlsAlertDescription alertDesc) { ! return CreateException(TlsAlert.GetAlertMessage(alertDesc)); } --- 400,408 ---- #region Exception Methods ! public TlsException CreateException( ! AlertLevel alertLevel, ! AlertDescription alertDesc) { ! return CreateException(Alert.GetAlertMessage(alertDesc)); } Index: RecordProtocol.cs =================================================================== RCS file: /cvsroot/pgsqlclient/pgsqlclient_10/Mono.Security/Mono.Security/Mono.Security.Protocol.Tls/RecordProtocol.cs,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** RecordProtocol.cs 24 Feb 2004 16:03:51 -0000 1.5 --- RecordProtocol.cs 3 Mar 2004 16:22:36 -0000 1.6 *************** *** 28,32 **** using System.Security.Cryptography.X509Certificates; - using Mono.Security.Protocol.Tls.Alerts; using Mono.Security.Protocol.Tls.Handshake; --- 28,31 ---- *************** *** 70,74 **** #region Abstract Methods ! public abstract void SendRecord(TlsHandshakeType type); protected abstract void ProcessHandshakeMessage(TlsStream handMsg); --- 69,73 ---- #region Abstract Methods ! public abstract void SendRecord(HandshakeType type); protected abstract void ProcessHandshakeMessage(TlsStream handMsg); *************** *** 93,99 **** } ! TlsContentType contentType = (TlsContentType)type; ! short protocol = this.readShort(); ! short length = this.readShort(); // Read Record data --- 92,98 ---- } ! ContentType contentType = (ContentType)type; ! short protocol = this.readShort(); ! short length = this.readShort(); // Read Record data *************** *** 115,119 **** // Decrypt message contents if needed ! if (contentType == TlsContentType.Alert && length == 2) { } --- 114,118 ---- // Decrypt message contents if needed ! if (contentType == ContentType.Alert && length == 2) { } *************** *** 121,125 **** { if (this.context.IsActual && ! contentType != TlsContentType.ChangeCipherSpec) { message = this.decryptRecordFragment( --- 120,124 ---- { if (this.context.IsActual && ! contentType != ContentType.ChangeCipherSpec) { message = this.decryptRecordFragment( *************** *** 134,152 **** switch (contentType) { ! case TlsContentType.Alert: this.processAlert( ! (TlsAlertLevel)message.ReadByte(), ! (TlsAlertDescription)message.ReadByte()); break; ! case TlsContentType.ChangeCipherSpec: // Reset sequence numbers this.context.ReadSequenceNumber = 0; break; ! case TlsContentType.ApplicationData: break; ! case TlsContentType.Handshake: while (!message.EOF) { --- 133,151 ---- switch (contentType) { ! case ContentType.Alert: this.processAlert( ! (AlertLevel)message.ReadByte(), ! (AlertDescription)message.ReadByte()); break; ! case ContentType.ChangeCipherSpec: // Reset sequence numbers this.context.ReadSequenceNumber = 0; break; ! case ContentType.ApplicationData: break; ! case ContentType.Handshake: while (!message.EOF) { *************** *** 176,192 **** private void processAlert( ! TlsAlertLevel alertLevel, ! TlsAlertDescription alertDesc) { switch (alertLevel) { ! case TlsAlertLevel.Fatal: throw this.context.CreateException(alertLevel, alertDesc); ! case TlsAlertLevel.Warning: default: switch (alertDesc) { ! case TlsAlertDescription.CloseNotify: this.context.ConnectionEnd = true; break; --- 175,191 ---- private void processAlert( ! AlertLevel alertLevel, ! AlertDescription alertDesc) { switch (alertLevel) { ! case AlertLevel.Fatal: throw this.context.CreateException(alertLevel, alertDesc); ! case AlertLevel.Warning: default: switch (alertDesc) { ! case AlertDescription.CloseNotify: this.context.ConnectionEnd = true; break; *************** *** 200,219 **** #region Send Alert Methods ! public void SendAlert(TlsAlertDescription description) { ! this.SendAlert(new TlsAlert(this.Context, description)); } public void SendAlert( ! TlsAlertLevel level, ! TlsAlertDescription description) { ! this.SendAlert(new TlsAlert(this.Context, level, description)); } ! public void SendAlert(TlsAlert alert) { // Write record ! this.SendRecord(TlsContentType.Alert, alert.ToArray()); // Update session --- 199,218 ---- #region Send Alert Methods ! public void SendAlert(AlertDescription description) { ! this.SendAlert(new Alert(this.Context, description)); } public void SendAlert( ! AlertLevel level, ! AlertDescription description) { ! this.SendAlert(new Alert(this.Context, level, description)); } ! public void SendAlert(Alert alert) { // Write record ! this.SendRecord(ContentType.Alert, alert.ToArray()); // Update session *************** *** 231,235 **** { // Send Change Cipher Spec message ! this.SendRecord(TlsContentType.ChangeCipherSpec, new byte[] {1}); // Reset sequence numbers --- 230,234 ---- { // Send Change Cipher Spec message ! this.SendRecord(ContentType.ChangeCipherSpec, new byte[] {1}); // Reset sequence numbers *************** *** 240,247 **** // Send Finished message ! this.SendRecord(TlsHandshakeType.Finished); } ! public void SendRecord(TlsContentType contentType, byte[] recordData) { if (this.context.ConnectionEnd) --- 239,246 ---- // Send Finished message ! this.SendRecord(HandshakeType.Finished); } ! public void SendRecord(ContentType contentType, byte[] recordData) { if (this.context.ConnectionEnd) *************** *** 255,259 **** } ! public byte[] EncodeRecord(TlsContentType contentType, byte[] recordData) { return this.EncodeRecord( --- 254,258 ---- } ! public byte[] EncodeRecord(ContentType contentType, byte[] recordData) { return this.EncodeRecord( *************** *** 265,272 **** public byte[] EncodeRecord( ! Tls... [truncated message content] |
From: <car...@us...> - 2004-03-03 16:33:58
|
Update of /cvsroot/pgsqlclient/pgsqlclient_10/Mono.Security/Mono.Security/Mono.Security.Protocol.Tls.Handshake.Server In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv19365 Modified Files: TlsServerCertificate.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 ) Index: TlsServerCertificate.cs =================================================================== RCS file: /cvsroot/pgsqlclient/pgsqlclient_10/Mono.Security/Mono.Security/Mono.Security.Protocol.Tls.Handshake.Server/TlsServerCertificate.cs,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** TlsServerCertificate.cs 3 Mar 2004 16:15:43 -0000 1.3 --- TlsServerCertificate.cs 3 Mar 2004 16:21:19 -0000 1.4 *************** *** 29,33 **** using X509Cert = System.Security.Cryptography.X509Certificates; - using Mono.Security.Protocol.Tls.Alerts; using Mono.Security.X509; --- 29,32 ---- |
From: <car...@us...> - 2004-03-03 16:33:46
|
Update of /cvsroot/pgsqlclient/pgsqlclient_10/Mono.Security/Mono.Security/Mono.Security.Protocol.Tls.Handshake.Client In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv19268 Modified Files: TlsServerCertificate.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 ) Index: TlsServerCertificate.cs =================================================================== RCS file: /cvsroot/pgsqlclient/pgsqlclient_10/Mono.Security/Mono.Security/Mono.Security.Protocol.Tls.Handshake.Client/TlsServerCertificate.cs,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** TlsServerCertificate.cs 3 Mar 2004 16:14:40 -0000 1.5 --- TlsServerCertificate.cs 3 Mar 2004 16:21:03 -0000 1.6 *************** *** 30,34 **** using X509Cert = System.Security.Cryptography.X509Certificates; - using Mono.Security.Protocol.Tls.Alerts; using Mono.Security.X509; --- 30,33 ---- |
From: <car...@us...> - 2004-03-03 16:31:47
|
Update of /cvsroot/pgsqlclient/pgsqlclient_10/Mono.Security/Mono.Security/Mono.Security.Protocol.Tls.Alerts In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv18938 Removed Files: TlsAlert.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 ) --- TlsAlert.cs DELETED --- |
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 --- |
Update of /cvsroot/pgsqlclient/pgsqlclient_10/Mono.Security/Mono.Security/Mono.Security.Protocol.Tls.Handshake.Server In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv18079 Modified Files: TlsClientCertificate.cs TlsClientCertificateVerify.cs TlsClientFinished.cs TlsClientHello.cs TlsClientKeyExchange.cs TlsServerCertificate.cs TlsServerCertificateRequest.cs TlsServerFinished.cs TlsServerHello.cs TlsServerHelloDone.cs TlsServerKeyExchange.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 ) Index: TlsClientCertificate.cs =================================================================== RCS file: /cvsroot/pgsqlclient/pgsqlclient_10/Mono.Security/Mono.Security/Mono.Security.Protocol.Tls.Handshake.Server/TlsClientCertificate.cs,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** TlsClientCertificate.cs 23 Feb 2004 12:19:31 -0000 1.2 --- TlsClientCertificate.cs 3 Mar 2004 16:15:42 -0000 1.3 *************** *** 29,38 **** namespace Mono.Security.Protocol.Tls.Handshake.Server { ! internal class TlsClientCertificate : TlsHandshakeMessage { #region Constructors public TlsClientCertificate(Context context, byte[] buffer) ! : base(context, TlsHandshakeType.Certificate, buffer) { } --- 29,38 ---- namespace Mono.Security.Protocol.Tls.Handshake.Server { ! internal class TlsClientCertificate : HandshakeMessage { #region Constructors public TlsClientCertificate(Context context, byte[] buffer) ! : base(context, HandshakeType.Certificate, buffer) { } Index: TlsClientCertificateVerify.cs =================================================================== RCS file: /cvsroot/pgsqlclient/pgsqlclient_10/Mono.Security/Mono.Security/Mono.Security.Protocol.Tls.Handshake.Server/TlsClientCertificateVerify.cs,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** TlsClientCertificateVerify.cs 23 Feb 2004 12:19:31 -0000 1.2 --- TlsClientCertificateVerify.cs 3 Mar 2004 16:15:42 -0000 1.3 *************** *** 31,40 **** namespace Mono.Security.Protocol.Tls.Handshake.Server { ! internal class TlsClientCertificateVerify : TlsHandshakeMessage { #region Constructors public TlsClientCertificateVerify(Context context, byte[] buffer) ! : base(context, TlsHandshakeType.Finished, buffer) { } --- 31,40 ---- namespace Mono.Security.Protocol.Tls.Handshake.Server { ! internal class TlsClientCertificateVerify : HandshakeMessage { #region Constructors public TlsClientCertificateVerify(Context context, byte[] buffer) ! : base(context, HandshakeType.Finished, buffer) { } Index: TlsClientFinished.cs =================================================================== RCS file: /cvsroot/pgsqlclient/pgsqlclient_10/Mono.Security/Mono.Security/Mono.Security.Protocol.Tls.Handshake.Server/TlsClientFinished.cs,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** TlsClientFinished.cs 23 Feb 2004 12:19:31 -0000 1.2 --- TlsClientFinished.cs 3 Mar 2004 16:15:43 -0000 1.3 *************** *** 30,39 **** namespace Mono.Security.Protocol.Tls.Handshake.Server { ! internal class TlsClientFinished : TlsHandshakeMessage { #region Constructors public TlsClientFinished(Context context, byte[] buffer) ! : base(context, TlsHandshakeType.Finished, buffer) { } --- 30,39 ---- namespace Mono.Security.Protocol.Tls.Handshake.Server { ! internal class TlsClientFinished : HandshakeMessage { #region Constructors public TlsClientFinished(Context context, byte[] buffer) ! : base(context, HandshakeType.Finished, buffer) { } Index: TlsClientHello.cs =================================================================== RCS file: /cvsroot/pgsqlclient/pgsqlclient_10/Mono.Security/Mono.Security/Mono.Security.Protocol.Tls.Handshake.Server/TlsClientHello.cs,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** TlsClientHello.cs 23 Feb 2004 12:19:31 -0000 1.2 --- TlsClientHello.cs 3 Mar 2004 16:15:43 -0000 1.3 *************** *** 28,37 **** namespace Mono.Security.Protocol.Tls.Handshake.Server { ! internal class TlsClientHello : TlsHandshakeMessage { #region Constructors public TlsClientHello(Context context, byte[] buffer) ! : base(context, TlsHandshakeType.ClientHello, buffer) { } --- 28,37 ---- namespace Mono.Security.Protocol.Tls.Handshake.Server { ! internal class TlsClientHello : HandshakeMessage { #region Constructors public TlsClientHello(Context context, byte[] buffer) ! : base(context, HandshakeType.ClientHello, buffer) { } Index: TlsClientKeyExchange.cs =================================================================== RCS file: /cvsroot/pgsqlclient/pgsqlclient_10/Mono.Security/Mono.Security/Mono.Security.Protocol.Tls.Handshake.Server/TlsClientKeyExchange.cs,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** TlsClientKeyExchange.cs 23 Feb 2004 12:19:31 -0000 1.2 --- TlsClientKeyExchange.cs 3 Mar 2004 16:15:43 -0000 1.3 *************** *** 29,33 **** namespace Mono.Security.Protocol.Tls.Handshake.Server { ! internal class TlsClientKeyExchange : TlsHandshakeMessage { #region Constructors --- 29,33 ---- namespace Mono.Security.Protocol.Tls.Handshake.Server { ! internal class TlsClientKeyExchange : HandshakeMessage { #region Constructors *************** *** 35,39 **** public TlsClientKeyExchange (Context context, byte[] buffer) : base(context, ! TlsHandshakeType.ClientKeyExchange, buffer) { --- 35,39 ---- public TlsClientKeyExchange (Context context, byte[] buffer) : base(context, ! HandshakeType.ClientKeyExchange, buffer) { Index: TlsServerCertificate.cs =================================================================== RCS file: /cvsroot/pgsqlclient/pgsqlclient_10/Mono.Security/Mono.Security/Mono.Security.Protocol.Tls.Handshake.Server/TlsServerCertificate.cs,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** TlsServerCertificate.cs 23 Feb 2004 12:19:31 -0000 1.2 --- TlsServerCertificate.cs 3 Mar 2004 16:15:43 -0000 1.3 *************** *** 34,43 **** namespace Mono.Security.Protocol.Tls.Handshake.Server { ! internal class TlsServerCertificate : TlsHandshakeMessage { #region Constructors public TlsServerCertificate(Context context) ! : base(context, TlsHandshakeType.Certificate) { } --- 34,43 ---- namespace Mono.Security.Protocol.Tls.Handshake.Server { ! internal class TlsServerCertificate : HandshakeMessage { #region Constructors public TlsServerCertificate(Context context) ! : base(context, HandshakeType.Certificate) { } Index: TlsServerCertificateRequest.cs =================================================================== RCS file: /cvsroot/pgsqlclient/pgsqlclient_10/Mono.Security/Mono.Security/Mono.Security.Protocol.Tls.Handshake.Server/TlsServerCertificateRequest.cs,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** TlsServerCertificateRequest.cs 23 Feb 2004 12:19:31 -0000 1.2 --- TlsServerCertificateRequest.cs 3 Mar 2004 16:15:43 -0000 1.3 *************** *** 29,38 **** namespace Mono.Security.Protocol.Tls.Handshake.Server { ! internal class TlsServerCertificateRequest : TlsHandshakeMessage { #region Constructors public TlsServerCertificateRequest(Context context) ! : base(context, TlsHandshakeType.ServerHello) { } --- 29,38 ---- namespace Mono.Security.Protocol.Tls.Handshake.Server { ! internal class TlsServerCertificateRequest : HandshakeMessage { #region Constructors public TlsServerCertificateRequest(Context context) ! : base(context, HandshakeType.ServerHello) { } Index: TlsServerFinished.cs =================================================================== RCS file: /cvsroot/pgsqlclient/pgsqlclient_10/Mono.Security/Mono.Security/Mono.Security.Protocol.Tls.Handshake.Server/TlsServerFinished.cs,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** TlsServerFinished.cs 23 Feb 2004 12:19:31 -0000 1.2 --- TlsServerFinished.cs 3 Mar 2004 16:15:43 -0000 1.3 *************** *** 30,39 **** namespace Mono.Security.Protocol.Tls.Handshake.Server { ! internal class TlsServerFinished : TlsHandshakeMessage { #region Constructors public TlsServerFinished(Context context) ! : base(context, TlsHandshakeType.ServerHello) { } --- 30,39 ---- namespace Mono.Security.Protocol.Tls.Handshake.Server { ! internal class TlsServerFinished : HandshakeMessage { #region Constructors public TlsServerFinished(Context context) ! : base(context, HandshakeType.ServerHello) { } Index: TlsServerHello.cs =================================================================== RCS file: /cvsroot/pgsqlclient/pgsqlclient_10/Mono.Security/Mono.Security/Mono.Security.Protocol.Tls.Handshake.Server/TlsServerHello.cs,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** TlsServerHello.cs 23 Feb 2004 12:19:31 -0000 1.2 --- TlsServerHello.cs 3 Mar 2004 16:15:43 -0000 1.3 *************** *** 27,36 **** namespace Mono.Security.Protocol.Tls.Handshake.Server { ! internal class TlsServerHello : TlsHandshakeMessage { #region Constructors public TlsServerHello(Context context) ! : base(context, TlsHandshakeType.ServerHello) { } --- 27,36 ---- namespace Mono.Security.Protocol.Tls.Handshake.Server { ! internal class TlsServerHello : HandshakeMessage { #region Constructors public TlsServerHello(Context context) ! : base(context, HandshakeType.ServerHello) { } Index: TlsServerHelloDone.cs =================================================================== RCS file: /cvsroot/pgsqlclient/pgsqlclient_10/Mono.Security/Mono.Security/Mono.Security.Protocol.Tls.Handshake.Server/TlsServerHelloDone.cs,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** TlsServerHelloDone.cs 23 Feb 2004 12:19:31 -0000 1.2 --- TlsServerHelloDone.cs 3 Mar 2004 16:15:43 -0000 1.3 *************** *** 27,36 **** namespace Mono.Security.Protocol.Tls.Handshake.Server { ! internal class TlsServerHelloDone : TlsHandshakeMessage { #region Constructors public TlsServerHelloDone(Context context) ! : base(context, TlsHandshakeType.ServerHello) { } --- 27,36 ---- namespace Mono.Security.Protocol.Tls.Handshake.Server { ! internal class TlsServerHelloDone : HandshakeMessage { #region Constructors public TlsServerHelloDone(Context context) ! : base(context, HandshakeType.ServerHello) { } Index: TlsServerKeyExchange.cs =================================================================== RCS file: /cvsroot/pgsqlclient/pgsqlclient_10/Mono.Security/Mono.Security/Mono.Security.Protocol.Tls.Handshake.Server/TlsServerKeyExchange.cs,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** TlsServerKeyExchange.cs 23 Feb 2004 12:19:31 -0000 1.2 --- TlsServerKeyExchange.cs 3 Mar 2004 16:15:43 -0000 1.3 *************** *** 31,40 **** namespace Mono.Security.Protocol.Tls.Handshake.Server { ! internal class TlsServerKeyExchange : TlsHandshakeMessage { #region Constructors public TlsServerKeyExchange(Context context) ! : base(context, TlsHandshakeType.ServerKeyExchange) { } --- 31,40 ---- namespace Mono.Security.Protocol.Tls.Handshake.Server { ! internal class TlsServerKeyExchange : HandshakeMessage { #region Constructors public TlsServerKeyExchange(Context context) ! : base(context, HandshakeType.ServerKeyExchange) { } |
Update of /cvsroot/pgsqlclient/pgsqlclient_10/Mono.Security/Mono.Security/Mono.Security.Protocol.Tls.Handshake.Client In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv17779 Modified Files: TlsClientCertificate.cs TlsClientCertificateVerify.cs TlsClientFinished.cs TlsClientHello.cs TlsClientKeyExchange.cs TlsServerCertificate.cs TlsServerCertificateRequest.cs TlsServerFinished.cs TlsServerHello.cs TlsServerHelloDone.cs TlsServerKeyExchange.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 ) Index: TlsClientCertificate.cs =================================================================== RCS file: /cvsroot/pgsqlclient/pgsqlclient_10/Mono.Security/Mono.Security/Mono.Security.Protocol.Tls.Handshake.Client/TlsClientCertificate.cs,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** TlsClientCertificate.cs 23 Feb 2004 12:18:52 -0000 1.4 --- TlsClientCertificate.cs 3 Mar 2004 16:14:40 -0000 1.5 *************** *** 30,39 **** namespace Mono.Security.Protocol.Tls.Handshake.Client { ! internal class TlsClientCertificate : TlsHandshakeMessage { #region Constructors public TlsClientCertificate(Context context) ! : base(context, TlsHandshakeType.Certificate) { } --- 30,39 ---- namespace Mono.Security.Protocol.Tls.Handshake.Client { ! internal class TlsClientCertificate : HandshakeMessage { #region Constructors public TlsClientCertificate(Context context) ! : base(context, HandshakeType.Certificate) { } Index: TlsClientCertificateVerify.cs =================================================================== RCS file: /cvsroot/pgsqlclient/pgsqlclient_10/Mono.Security/Mono.Security/Mono.Security.Protocol.Tls.Handshake.Client/TlsClientCertificateVerify.cs,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** TlsClientCertificateVerify.cs 23 Feb 2004 12:18:52 -0000 1.2 --- TlsClientCertificateVerify.cs 3 Mar 2004 16:14:40 -0000 1.3 *************** *** 31,40 **** namespace Mono.Security.Protocol.Tls.Handshake.Client { ! internal class TlsClientCertificateVerify : TlsHandshakeMessage { #region Constructors public TlsClientCertificateVerify(Context context) ! : base(context, TlsHandshakeType.Finished) { } --- 31,40 ---- namespace Mono.Security.Protocol.Tls.Handshake.Client { ! internal class TlsClientCertificateVerify : HandshakeMessage { #region Constructors public TlsClientCertificateVerify(Context context) ! : base(context, HandshakeType.Finished) { } Index: TlsClientFinished.cs =================================================================== RCS file: /cvsroot/pgsqlclient/pgsqlclient_10/Mono.Security/Mono.Security/Mono.Security.Protocol.Tls.Handshake.Client/TlsClientFinished.cs,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** TlsClientFinished.cs 23 Feb 2004 12:18:52 -0000 1.2 --- TlsClientFinished.cs 3 Mar 2004 16:14:40 -0000 1.3 *************** *** 30,39 **** namespace Mono.Security.Protocol.Tls.Handshake.Client { ! internal class TlsClientFinished : TlsHandshakeMessage { #region Constructors public TlsClientFinished(Context context) ! : base(context, TlsHandshakeType.Finished) { } --- 30,39 ---- namespace Mono.Security.Protocol.Tls.Handshake.Client { ! internal class TlsClientFinished : HandshakeMessage { #region Constructors public TlsClientFinished(Context context) ! : base(context, HandshakeType.Finished) { } *************** *** 56,60 **** { // Compute handshake messages hashes ! HashAlgorithm hash = new TlsSslHandshakeHash(this.Context.MasterSecret); TlsStream data = new TlsStream(); --- 56,60 ---- { // Compute handshake messages hashes ! HashAlgorithm hash = new SslHandshakeHash(this.Context.MasterSecret); TlsStream data = new TlsStream(); Index: TlsClientHello.cs =================================================================== RCS file: /cvsroot/pgsqlclient/pgsqlclient_10/Mono.Security/Mono.Security/Mono.Security.Protocol.Tls.Handshake.Client/TlsClientHello.cs,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** TlsClientHello.cs 23 Feb 2004 12:18:52 -0000 1.4 --- TlsClientHello.cs 3 Mar 2004 16:14:40 -0000 1.5 *************** *** 28,32 **** namespace Mono.Security.Protocol.Tls.Handshake.Client { ! internal class TlsClientHello : TlsHandshakeMessage { #region Fields --- 28,32 ---- namespace Mono.Security.Protocol.Tls.Handshake.Client { ! internal class TlsClientHello : HandshakeMessage { #region Fields *************** *** 39,43 **** public TlsClientHello(Context context) ! : base(context, TlsHandshakeType.ClientHello) { } --- 39,43 ---- public TlsClientHello(Context context) ! : base(context, HandshakeType.ClientHello) { } Index: TlsClientKeyExchange.cs =================================================================== RCS file: /cvsroot/pgsqlclient/pgsqlclient_10/Mono.Security/Mono.Security/Mono.Security.Protocol.Tls.Handshake.Client/TlsClientKeyExchange.cs,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** TlsClientKeyExchange.cs 23 Feb 2004 12:18:52 -0000 1.2 --- TlsClientKeyExchange.cs 3 Mar 2004 16:14:40 -0000 1.3 *************** *** 29,33 **** namespace Mono.Security.Protocol.Tls.Handshake.Client { ! internal class TlsClientKeyExchange : TlsHandshakeMessage { #region Constructors --- 29,33 ---- namespace Mono.Security.Protocol.Tls.Handshake.Client { ! internal class TlsClientKeyExchange : HandshakeMessage { #region Constructors *************** *** 35,39 **** public TlsClientKeyExchange (Context context) : base(context, ! TlsHandshakeType.ClientKeyExchange) { } --- 35,39 ---- public TlsClientKeyExchange (Context context) : base(context, ! HandshakeType.ClientKeyExchange) { } Index: TlsServerCertificate.cs =================================================================== RCS file: /cvsroot/pgsqlclient/pgsqlclient_10/Mono.Security/Mono.Security/Mono.Security.Protocol.Tls.Handshake.Client/TlsServerCertificate.cs,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** TlsServerCertificate.cs 23 Feb 2004 12:18:52 -0000 1.4 --- TlsServerCertificate.cs 3 Mar 2004 16:14:40 -0000 1.5 *************** *** 35,39 **** namespace Mono.Security.Protocol.Tls.Handshake.Client { ! internal class TlsServerCertificate : TlsHandshakeMessage { #region Fields --- 35,39 ---- namespace Mono.Security.Protocol.Tls.Handshake.Client { ! internal class TlsServerCertificate : HandshakeMessage { #region Fields *************** *** 46,50 **** public TlsServerCertificate(Context context, byte[] buffer) ! : base(context, TlsHandshakeType.Certificate, buffer) { } --- 46,50 ---- public TlsServerCertificate(Context context, byte[] buffer) ! : base(context, HandshakeType.Certificate, buffer) { } Index: TlsServerCertificateRequest.cs =================================================================== RCS file: /cvsroot/pgsqlclient/pgsqlclient_10/Mono.Security/Mono.Security/Mono.Security.Protocol.Tls.Handshake.Client/TlsServerCertificateRequest.cs,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** TlsServerCertificateRequest.cs 23 Feb 2004 12:18:52 -0000 1.2 --- TlsServerCertificateRequest.cs 3 Mar 2004 16:14:40 -0000 1.3 *************** *** 29,38 **** namespace Mono.Security.Protocol.Tls.Handshake.Client { ! internal class TlsServerCertificateRequest : TlsHandshakeMessage { #region Fields ! private TlsClientCertificateType[] certificateTypes; ! private string[] distinguisedNames; #endregion --- 29,38 ---- namespace Mono.Security.Protocol.Tls.Handshake.Client { ! internal class TlsServerCertificateRequest : HandshakeMessage { #region Fields ! private ClientCertificateType[] certificateTypes; ! private string[] distinguisedNames; #endregion *************** *** 41,45 **** public TlsServerCertificateRequest(Context context, byte[] buffer) ! : base(context, TlsHandshakeType.ServerHello, buffer) { } --- 41,45 ---- public TlsServerCertificateRequest(Context context, byte[] buffer) ! : base(context, HandshakeType.ServerHello, buffer) { } *************** *** 72,80 **** int typesCount = this.ReadByte(); ! this.certificateTypes = new TlsClientCertificateType[typesCount]; for (int i = 0; i < typesCount; i++) { ! this.certificateTypes[i] = (TlsClientCertificateType)this.ReadByte(); } --- 72,80 ---- int typesCount = this.ReadByte(); ! this.certificateTypes = new ClientCertificateType[typesCount]; for (int i = 0; i < typesCount; i++) { ! this.certificateTypes[i] = (ClientCertificateType)this.ReadByte(); } Index: TlsServerFinished.cs =================================================================== RCS file: /cvsroot/pgsqlclient/pgsqlclient_10/Mono.Security/Mono.Security/Mono.Security.Protocol.Tls.Handshake.Client/TlsServerFinished.cs,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** TlsServerFinished.cs 25 Feb 2004 15:42:17 -0000 1.3 --- TlsServerFinished.cs 3 Mar 2004 16:14:40 -0000 1.4 *************** *** 30,39 **** namespace Mono.Security.Protocol.Tls.Handshake.Client { ! internal class TlsServerFinished : TlsHandshakeMessage { #region Constructors public TlsServerFinished(Context context, byte[] buffer) ! : base(context, TlsHandshakeType.ServerHello, buffer) { } --- 30,39 ---- namespace Mono.Security.Protocol.Tls.Handshake.Client { ! internal class TlsServerFinished : HandshakeMessage { #region Constructors public TlsServerFinished(Context context, byte[] buffer) ! : base(context, HandshakeType.ServerHello, buffer) { } *************** *** 61,65 **** { // Compute handshake messages hashes ! HashAlgorithm hash = new TlsSslHandshakeHash(this.Context.MasterSecret); TlsStream data = new TlsStream(); --- 61,65 ---- { // Compute handshake messages hashes ! HashAlgorithm hash = new SslHandshakeHash(this.Context.MasterSecret); TlsStream data = new TlsStream(); Index: TlsServerHello.cs =================================================================== RCS file: /cvsroot/pgsqlclient/pgsqlclient_10/Mono.Security/Mono.Security/Mono.Security.Protocol.Tls.Handshake.Client/TlsServerHello.cs,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** TlsServerHello.cs 23 Feb 2004 12:18:52 -0000 1.3 --- TlsServerHello.cs 3 Mar 2004 16:14:40 -0000 1.4 *************** *** 27,31 **** namespace Mono.Security.Protocol.Tls.Handshake.Client { ! internal class TlsServerHello : TlsHandshakeMessage { #region Fields --- 27,31 ---- namespace Mono.Security.Protocol.Tls.Handshake.Client { ! internal class TlsServerHello : HandshakeMessage { #region Fields *************** *** 41,45 **** public TlsServerHello(Context context, byte[] buffer) ! : base(context, TlsHandshakeType.ServerHello, buffer) { } --- 41,45 ---- public TlsServerHello(Context context, byte[] buffer) ! : base(context, HandshakeType.ServerHello, buffer) { } *************** *** 126,130 **** this.Context.SupportedCiphers.Clear(); this.Context.SupportedCiphers = null; ! this.Context.SupportedCiphers = TlsCipherSuiteFactory.GetSupportedCiphers(serverProtocol); } else --- 126,130 ---- this.Context.SupportedCiphers.Clear(); this.Context.SupportedCiphers = null; ! this.Context.SupportedCiphers = CipherSuiteFactory.GetSupportedCiphers(serverProtocol); } else Index: TlsServerHelloDone.cs =================================================================== RCS file: /cvsroot/pgsqlclient/pgsqlclient_10/Mono.Security/Mono.Security/Mono.Security.Protocol.Tls.Handshake.Client/TlsServerHelloDone.cs,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** TlsServerHelloDone.cs 23 Feb 2004 12:18:52 -0000 1.2 --- TlsServerHelloDone.cs 3 Mar 2004 16:14:40 -0000 1.3 *************** *** 27,50 **** namespace Mono.Security.Protocol.Tls.Handshake.Client { ! internal class TlsServerHelloDone : TlsHandshakeMessage { #region Constructors public TlsServerHelloDone(Context context, byte[] buffer) ! : base(context, TlsHandshakeType.ServerHello, buffer) ! { ! } ! ! #endregion ! ! #region Methods ! ! public override void Update() { - ClientContext context = (ClientContext)this.Context; - - base.Update(); - - context.HelloDone = true; } --- 27,37 ---- namespace Mono.Security.Protocol.Tls.Handshake.Client { ! internal class TlsServerHelloDone : HandshakeMessage { #region Constructors public TlsServerHelloDone(Context context, byte[] buffer) ! : base(context, HandshakeType.ServerHello, buffer) { } Index: TlsServerKeyExchange.cs =================================================================== RCS file: /cvsroot/pgsqlclient/pgsqlclient_10/Mono.Security/Mono.Security/Mono.Security.Protocol.Tls.Handshake.Client/TlsServerKeyExchange.cs,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** TlsServerKeyExchange.cs 23 Feb 2004 12:18:52 -0000 1.2 --- TlsServerKeyExchange.cs 3 Mar 2004 16:14:40 -0000 1.3 *************** *** 31,35 **** namespace Mono.Security.Protocol.Tls.Handshake.Client { ! internal class TlsServerKeyExchange : TlsHandshakeMessage { #region Fields --- 31,35 ---- namespace Mono.Security.Protocol.Tls.Handshake.Client { ! internal class TlsServerKeyExchange : HandshakeMessage { #region Fields *************** *** 43,47 **** public TlsServerKeyExchange(Context context, byte[] buffer) ! : base(context, TlsHandshakeType.ServerKeyExchange, buffer) { this.verifySignature(); --- 43,47 ---- public TlsServerKeyExchange(Context context, byte[] buffer) ! : base(context, HandshakeType.ServerKeyExchange, buffer) { this.verifySignature(); |
From: <car...@us...> - 2004-02-25 15:50:58
|
Update of /cvsroot/pgsqlclient/pgsqlclient_10 In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv15338 Modified Files: changelog.txt Log Message: 2004-02-25 Carlos Guzman Alvarez <car...@te...> * Mono.Security.Protocol.Tls/HandshakeState.cs: - New file. * Mono.Security.Protocol.Tls.Alerts/TlsAlert.cs: - Modified the level of some alerts according to the RFC. * Mono.Security.Protocol.Tls/SslClientStream.cs: * Mono.Security.Protocol.Tls/SslServerStream.cs: * Mono.Security.Protocol.Tls/Context.cs: * Mono.Security.Protocol.Tls/ClientContext.cs: * Mono.Security.Protocol.Tls/ClientRecordProtocol.cs: * Mono.Security.Protocol.Tls.Handshake.Client/TlsServerFinished.cs: - Added changes for better handling of ClientHelloRequest messages. Index: changelog.txt =================================================================== RCS file: /cvsroot/pgsqlclient/pgsqlclient_10/changelog.txt,v retrieving revision 1.97 retrieving revision 1.98 diff -C2 -d -r1.97 -r1.98 *** changelog.txt 24 Feb 2004 16:06:57 -0000 1.97 --- changelog.txt 25 Feb 2004 15:43:43 -0000 1.98 *************** *** 2,5 **** --- 2,24 ---- ------------------------------------------------------- + 2004-02-25 Carlos Guzman Alvarez <car...@te...> + + * Mono.Security.Protocol.Tls/HandshakeState.cs: + + - New file. + + * Mono.Security.Protocol.Tls.Alerts/TlsAlert.cs: + + - Modified the level of some alerts according to the RFC. + + * Mono.Security.Protocol.Tls/SslClientStream.cs: + * Mono.Security.Protocol.Tls/SslServerStream.cs: + * Mono.Security.Protocol.Tls/Context.cs: + * Mono.Security.Protocol.Tls/ClientContext.cs: + * Mono.Security.Protocol.Tls/ClientRecordProtocol.cs: + * Mono.Security.Protocol.Tls.Handshake.Client/TlsServerFinished.cs: + + - Added changes for better handling of ClientHelloRequest messages. + 2004-02-24 Carlos Guzman Alvarez <car...@te...> *************** *** 15,19 **** - Reimplementation of TLS/SSL Alert Protocol. - 2004-02-23 Carlos Guzman Alvarez <car...@te...> --- 34,37 ---- |
From: <car...@us...> - 2004-02-25 15:50:25
|
Update of /cvsroot/pgsqlclient/pgsqlclient_10/Mono.Security In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv15247 Modified Files: changelog.txt Log Message: 2004-02-25 Carlos Guzman Alvarez <car...@te...> * Mono.Security.Protocol.Tls/HandshakeState.cs: - New file. * Mono.Security.Protocol.Tls.Alerts/TlsAlert.cs: - Modified the level of some alerts according to the RFC. * Mono.Security.Protocol.Tls/SslClientStream.cs: * Mono.Security.Protocol.Tls/SslServerStream.cs: * Mono.Security.Protocol.Tls/Context.cs: * Mono.Security.Protocol.Tls/ClientContext.cs: * Mono.Security.Protocol.Tls/ClientRecordProtocol.cs: * Mono.Security.Protocol.Tls.Handshake.Client/TlsServerFinished.cs: - Added changes for better handling of ClientHelloRequest messages. Index: changelog.txt =================================================================== RCS file: /cvsroot/pgsqlclient/pgsqlclient_10/Mono.Security/changelog.txt,v retrieving revision 1.13 retrieving revision 1.14 diff -C2 -d -r1.13 -r1.14 *** changelog.txt 24 Feb 2004 16:06:30 -0000 1.13 --- changelog.txt 25 Feb 2004 15:43:09 -0000 1.14 *************** *** 2,5 **** --- 2,25 ---- --------------- ----------- ----------------------------------------- + + 2004-02-25 Carlos Guzman Alvarez <car...@te...> + + * Mono.Security.Protocol.Tls/HandshakeState.cs: + + - New file. + + * Mono.Security.Protocol.Tls.Alerts/TlsAlert.cs: + + - Modified the level of some alerts according to the RFC. + + * Mono.Security.Protocol.Tls/SslClientStream.cs: + * Mono.Security.Protocol.Tls/SslServerStream.cs: + * Mono.Security.Protocol.Tls/Context.cs: + * Mono.Security.Protocol.Tls/ClientContext.cs: + * Mono.Security.Protocol.Tls/ClientRecordProtocol.cs: + * Mono.Security.Protocol.Tls.Handshake.Client/TlsServerFinished.cs: + + - Added changes for better handling of ClientHelloRequest messages. + 2004-02-24 Carlos Guzman Alvarez <car...@te...> |
From: <car...@us...> - 2004-02-25 15:49:32
|
Update of /cvsroot/pgsqlclient/pgsqlclient_10/Mono.Security/Mono.Security/Mono.Security.Protocol.Tls.Handshake.Client In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv14927 Modified Files: TlsServerFinished.cs Log Message: 2004-02-25 Carlos Guzman Alvarez <car...@te...> * Mono.Security.Protocol.Tls/HandshakeState.cs: - New file. * Mono.Security.Protocol.Tls.Alerts/TlsAlert.cs: - Modified the level of some alerts according to the RFC. * Mono.Security.Protocol.Tls/SslClientStream.cs: * Mono.Security.Protocol.Tls/SslServerStream.cs: * Mono.Security.Protocol.Tls/Context.cs: * Mono.Security.Protocol.Tls/ClientContext.cs: * Mono.Security.Protocol.Tls/ClientRecordProtocol.cs: * Mono.Security.Protocol.Tls.Handshake.Client/TlsServerFinished.cs: - Added changes for better handling of ClientHelloRequest messages. Index: TlsServerFinished.cs =================================================================== RCS file: /cvsroot/pgsqlclient/pgsqlclient_10/Mono.Security/Mono.Security/Mono.Security.Protocol.Tls.Handshake.Client/TlsServerFinished.cs,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** TlsServerFinished.cs 23 Feb 2004 12:18:52 -0000 1.2 --- TlsServerFinished.cs 25 Feb 2004 15:42:17 -0000 1.3 *************** *** 51,55 **** // Hahdshake is finished ! this.Context.HandshakeFinished = true; } --- 51,55 ---- // Hahdshake is finished ! this.Context.HandshakeState = HandshakeState.Finished; } |