Sync file
authorCarlos Guzmán Álvarez <carlos@mono-cvs.ximian.com>
Mon, 20 Oct 2003 21:32:34 +0000 (21:32 -0000)
committerCarlos Guzmán Álvarez <carlos@mono-cvs.ximian.com>
Mon, 20 Oct 2003 21:32:34 +0000 (21:32 -0000)
svn path=/trunk/mcs/; revision=19231

mcs/class/Mono.Security/Mono.Security.Protocol.Tls.Alerts/TlsAlert.cs
mcs/class/Mono.Security/Mono.Security.Protocol.Tls.Alerts/TlsCloseNotifyAlert.cs
mcs/class/Mono.Security/Mono.Security.Protocol.Tls.Alerts/TlsWarningAlertEventArgs.cs
mcs/class/Mono.Security/Mono.Security.Protocol.Tls.Handshake/TlsClientCertificateType.cs
mcs/class/Mono.Security/Mono.Security.Protocol.Tls.Handshake/TlsHandshakeHashes.cs
mcs/class/Mono.Security/Mono.Security.Protocol.Tls.Handshake/TlsHandshakeType.cs
mcs/class/Mono.Security/Mono.Security.Protocol.Tls/TlsSessionState.cs

index f88298b18bf0324a4eb30a11da546350f2643560..9a96aca52e78085dda19038d8ff18fe4fe37e41c 100644 (file)
-/* Transport Security Layer (TLS)\r
- * Copyright (c) 2003 Carlos Guzmán Álvarez\r
- * \r
- * Permission is hereby granted, free of charge, to any person \r
- * obtaining a copy of this software and associated documentation \r
- * files (the "Software"), to deal in the Software without restriction, \r
- * including without limitation the rights to use, copy, modify, merge, \r
- * publish, distribute, sublicense, and/or sell copies of the Software, \r
- * and to permit persons to whom the Software is furnished to do so, \r
- * subject to the following conditions:\r
- * \r
- * The above copyright notice and this permission notice shall be included \r
- * in all copies or substantial portions of the Software.\r
- * \r
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, \r
- * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES \r
- * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND \r
- * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT \r
- * HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, \r
- * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, \r
- * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER \r
- * DEALINGS IN THE SOFTWARE.\r
- */\r
-\r
-using System;\r
-using Mono.Security.Protocol.Tls;\r
-\r
-namespace Mono.Security.Protocol.Tls.Alerts\r
-{\r
-       #region ENUMS\r
-\r
-       public enum TlsAlertLevel : byte\r
-       {\r
-               Warning = 1,\r
-               Fatal   = 2\r
-       }\r
-\r
-       public enum TlsAlertDescription : byte\r
-       {\r
-               CloseNotify                             = 0,\r
-               UnexpectedMessage               = 10,\r
-               BadRecordMAC                    = 20,\r
-               DecryptionFailed                = 21,\r
-               RecordOverflow                  = 22,\r
-               DecompressionFailiure   = 30,\r
-               HandshakeFailiure               = 40,\r
-               BadCertificate                  = 42,\r
-               UnsupportedCertificate  = 43,\r
-               CertificateRevoked              = 44,\r
-               CertificateExpired              = 45,\r
-               CertificateUnknown              = 46,\r
-               IlegalParameter                 = 47,\r
-               UnknownCA                               = 48,\r
-               AccessDenied                    = 49,\r
-               DecodeError                             = 50,\r
-               DecryptError                    = 51,\r
-               ExportRestriction               = 60,\r
-               ProtocolVersion                 = 70,\r
-               InsuficientSecurity             = 71,\r
-               InternalError                   = 80,\r
-               UserCancelled                   = 90,\r
-               NoRenegotiation                 = 100\r
-       }\r
-\r
-       #endregion\r
-       \r
-       internal abstract class TlsAlert : TlsStream\r
-       {\r
-               #region FIELDS\r
-\r
-               private TlsSession                      session;\r
-               private TlsAlertLevel           level;\r
-               private TlsAlertDescription description;\r
-\r
-               #endregion\r
-\r
-               #region PROPERTIES\r
-\r
-               public TlsSession Session\r
-               {\r
-                       get { return session; }\r
-               }\r
-\r
-               #endregion\r
-\r
-               #region CONSTRUCTORS\r
-\r
-               public TlsAlert(TlsSession session,\r
-                       TlsAlertLevel level,\r
-                       TlsAlertDescription description) : base()\r
-               {\r
-                       this.session            = session;\r
-                       this.level                      = level;\r
-                       this.description        = description;\r
-\r
-                       this.fill();\r
-               }\r
-\r
-               #endregion\r
-\r
-               #region ABSTRACT_METHODS\r
-\r
-               public abstract void UpdateSession();\r
-\r
-               #endregion\r
-\r
-               #region CONSTRUCTORS\r
-\r
-               private void fill()\r
-               {\r
-                       Write((byte)level);\r
-                       Write((byte)description);\r
-               }\r
-\r
-               #endregion\r
-\r
-               #region STATIC_METHODS\r
-\r
-               internal static string GetAlertMessage(TlsAlertDescription description)\r
-               {\r
-                       switch (description)\r
-                       {\r
-                               case TlsAlertDescription.AccessDenied:\r
-                                       return "An inappropriate message was received.";\r
-\r
-                               case TlsAlertDescription.BadCertificate:\r
-                                       return "TLSCiphertext decrypted in an invalid way.";\r
-\r
-                               case TlsAlertDescription.BadRecordMAC:\r
-                                       return "Record with an incorrect MAC.";\r
-\r
-                               case TlsAlertDescription.CertificateExpired:\r
-                                       return "Certificate has expired or is not currently valid";\r
-\r
-                               case TlsAlertDescription.CertificateRevoked:\r
-                                       return "Certificate was revoked by its signer.";\r
-                                       \r
-                               case TlsAlertDescription.CertificateUnknown:\r
-                                       return "Certificate Unknown.";\r
-\r
-                               case TlsAlertDescription.CloseNotify:\r
-                                       return "Connection closed";\r
-\r
-                               case TlsAlertDescription.DecodeError:\r
-                                       return "A message could not be decoded because some field was out of the specified range or the length of the message was incorrect.";\r
-\r
-                               case TlsAlertDescription.DecompressionFailiure:\r
-                                       return "The decompression function received improper input (e.g. data that would expand to excessive length).";\r
-\r
-                               case TlsAlertDescription.DecryptError:\r
-                                       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.";\r
-\r
-                               case TlsAlertDescription.DecryptionFailed:\r
-                                       return "Handshake cryptographic operation failed, including being unable to correctly verify a signature, decrypt a key exchange, or validate finished message.";\r
-\r
-                               case TlsAlertDescription.ExportRestriction:\r
-                                       return "Negotiation not in compliance with export restrictions was detected.";\r
-\r
-                               case TlsAlertDescription.HandshakeFailiure:\r
-                                       return "Unable to negotiate an acceptable set of security parameters given the options available.";\r
-\r
-                               case TlsAlertDescription.IlegalParameter:\r
-                                       return "A field in the handshake was out of range or inconsistent with other fields.";\r
-                                       \r
-                               case TlsAlertDescription.InsuficientSecurity:\r
-                                       return "Negotiation has failed specifically because the server requires ciphers more secure than those supported by the client.";\r
-                                       \r
-                               case TlsAlertDescription.InternalError:\r
-                                       return "Internal error unrelated to the peer or the correctness of the protocol makes it impossible to continue.";\r
-\r
-                               case TlsAlertDescription.NoRenegotiation:\r
-                                       return "Invalid renegotiation.";\r
-\r
-                               case TlsAlertDescription.ProtocolVersion:\r
-                                       return "Unsupported protocol version.";\r
-\r
-                               case TlsAlertDescription.RecordOverflow:\r
-                                       return "Invalid length on TLSCiphertext record or TLSCompressed record.";\r
-\r
-                               case TlsAlertDescription.UnexpectedMessage:\r
-                                       return "Invalid message receive.";\r
-\r
-                               case TlsAlertDescription.UnknownCA:\r
-                                       return "CA can't be identified as a trusted CA.";\r
-\r
-                               case TlsAlertDescription.UnsupportedCertificate:\r
-                                       return "Certificate was of an unsupported type.";\r
-\r
-                               case TlsAlertDescription.UserCancelled:\r
-                                       return "Handshake cancelled by user.";\r
-\r
-                               default:\r
-                                       return "";\r
-                       }\r
-               }\r
-\r
-               #endregion\r
-       }\r
-}\r
+/* Transport Security Layer (TLS)
+ * Copyright (c) 2003 Carlos Guzmán Álvarez
+ * 
+ * Permission is hereby granted, free of charge, to any person 
+ * obtaining a copy of this software and associated documentation 
+ * files (the "Software"), to deal in the Software without restriction, 
+ * including without limitation the rights to use, copy, modify, merge, 
+ * publish, distribute, sublicense, and/or sell copies of the Software, 
+ * and to permit persons to whom the Software is furnished to do so, 
+ * subject to the following conditions:
+ * 
+ * The above copyright notice and this permission notice shall be included 
+ * in all copies or substantial portions of the Software.
+ * 
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 
+ * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES 
+ * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 
+ * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT 
+ * HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, 
+ * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER 
+ * DEALINGS IN THE SOFTWARE.
+ */
+
+using System;
+using Mono.Security.Protocol.Tls;
+
+namespace Mono.Security.Protocol.Tls.Alerts
+{
+       #region ENUMS
+
+       public enum TlsAlertLevel : byte
+       {
+               Warning = 1,
+               Fatal   = 2
+       }
+
+       public enum TlsAlertDescription : 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 abstract class TlsAlert : TlsStream
+       {
+               #region FIELDS
+
+               private TlsSession                      session;
+               private TlsAlertLevel           level;
+               private TlsAlertDescription description;
+
+               #endregion
+
+               #region PROPERTIES
+
+               public TlsSession Session
+               {
+                       get { return session; }
+               }
+
+               #endregion
+
+               #region CONSTRUCTORS
+
+               public TlsAlert(TlsSession session,
+                       TlsAlertLevel level,
+                       TlsAlertDescription description) : base()
+               {
+                       this.session            = session;
+                       this.level                      = level;
+                       this.description        = description;
+
+                       this.fill();
+               }
+
+               #endregion
+
+               #region ABSTRACT_METHODS
+
+               public abstract void UpdateSession();
+
+               #endregion
+
+               #region CONSTRUCTORS
+
+               private void fill()
+               {
+                       Write((byte)level);
+                       Write((byte)description);
+               }
+
+               #endregion
+
+               #region STATIC_METHODS
+
+               internal static string GetAlertMessage(TlsAlertDescription description)
+               {
+                       switch (description)
+                       {
+                               case TlsAlertDescription.AccessDenied:
+                                       return "An inappropriate message was received.";
+
+                               case TlsAlertDescription.BadCertificate:
+                                       return "TLSCiphertext decrypted in an invalid way.";
+
+                               case TlsAlertDescription.BadRecordMAC:
+                                       return "Record with an incorrect MAC.";
+
+                               case TlsAlertDescription.CertificateExpired:
+                                       return "Certificate has expired or is not currently valid";
+
+                               case TlsAlertDescription.CertificateRevoked:
+                                       return "Certificate was revoked by its signer.";
+                                       
+                               case TlsAlertDescription.CertificateUnknown:
+                                       return "Certificate Unknown.";
+
+                               case TlsAlertDescription.CloseNotify:
+                                       return "Connection closed";
+
+                               case TlsAlertDescription.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 TlsAlertDescription.DecompressionFailiure:
+                                       return "The decompression function received improper input (e.g. data that would expand to excessive length).";
+
+                               case TlsAlertDescription.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 TlsAlertDescription.DecryptionFailed:
+                                       return "Handshake cryptographic operation failed, including being unable to correctly verify a signature, decrypt a key exchange, or validate finished message.";
+
+                               case TlsAlertDescription.ExportRestriction:
+                                       return "Negotiation not in compliance with export restrictions was detected.";
+
+                               case TlsAlertDescription.HandshakeFailiure:
+                                       return "Unable to negotiate an acceptable set of security parameters given the options available.";
+
+                               case TlsAlertDescription.IlegalParameter:
+                                       return "A field in the handshake was out of range or inconsistent with other fields.";
+                                       
+                               case TlsAlertDescription.InsuficientSecurity:
+                                       return "Negotiation has failed specifically because the server requires ciphers more secure than those supported by the client.";
+                                       
+                               case TlsAlertDescription.InternalError:
+                                       return "Internal error unrelated to the peer or the correctness of the protocol makes it impossible to continue.";
+
+                               case TlsAlertDescription.NoRenegotiation:
+                                       return "Invalid renegotiation.";
+
+                               case TlsAlertDescription.ProtocolVersion:
+                                       return "Unsupported protocol version.";
+
+                               case TlsAlertDescription.RecordOverflow:
+                                       return "Invalid length on TLSCiphertext record or TLSCompressed record.";
+
+                               case TlsAlertDescription.UnexpectedMessage:
+                                       return "Invalid message receive.";
+
+                               case TlsAlertDescription.UnknownCA:
+                                       return "CA can't be identified as a trusted CA.";
+
+                               case TlsAlertDescription.UnsupportedCertificate:
+                                       return "Certificate was of an unsupported type.";
+
+                               case TlsAlertDescription.UserCancelled:
+                                       return "Handshake cancelled by user.";
+
+                               default:
+                                       return "";
+                       }
+               }
+
+               #endregion
+       }
+}
index fd5083e672e43bb2bbf6a383e418de5422e3aa02..2e573a2924a487ae4274ac18a8768e41060afad5 100644 (file)
@@ -1,44 +1,44 @@
-/* Transport Security Layer (TLS)\r
- * Copyright (c) 2003 Carlos Guzmán Álvarez\r
- * \r
- * Permission is hereby granted, free of charge, to any person \r
- * obtaining a copy of this software and associated documentation \r
- * files (the "Software"), to deal in the Software without restriction, \r
- * including without limitation the rights to use, copy, modify, merge, \r
- * publish, distribute, sublicense, and/or sell copies of the Software, \r
- * and to permit persons to whom the Software is furnished to do so, \r
- * subject to the following conditions:\r
- * \r
- * The above copyright notice and this permission notice shall be included \r
- * in all copies or substantial portions of the Software.\r
- * \r
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, \r
- * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES \r
- * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND \r
- * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT \r
- * HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, \r
- * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, \r
- * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER \r
- * DEALINGS IN THE SOFTWARE.\r
- */\r
-\r
-using System;\r
-using Mono.Security.Protocol.Tls;\r
-\r
-namespace Mono.Security.Protocol.Tls.Alerts\r
-{\r
-       internal class TlsCloseNotifyAlert : TlsAlert\r
-       {\r
-               public TlsCloseNotifyAlert(TlsSession session) \r
-                       : base(session,  \r
-                                       TlsAlertLevel.Warning, \r
-                                       TlsAlertDescription.CloseNotify)\r
-               {\r
-               }\r
-\r
-               public override void UpdateSession()\r
-               {\r
-                       this.Session.Context.ConnectionEnd = true;\r
-               }       \r
-       }\r
-}\r
+/* Transport Security Layer (TLS)
+ * Copyright (c) 2003 Carlos Guzmán Álvarez
+ * 
+ * Permission is hereby granted, free of charge, to any person 
+ * obtaining a copy of this software and associated documentation 
+ * files (the "Software"), to deal in the Software without restriction, 
+ * including without limitation the rights to use, copy, modify, merge, 
+ * publish, distribute, sublicense, and/or sell copies of the Software, 
+ * and to permit persons to whom the Software is furnished to do so, 
+ * subject to the following conditions:
+ * 
+ * The above copyright notice and this permission notice shall be included 
+ * in all copies or substantial portions of the Software.
+ * 
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 
+ * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES 
+ * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 
+ * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT 
+ * HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, 
+ * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER 
+ * DEALINGS IN THE SOFTWARE.
+ */
+
+using System;
+using Mono.Security.Protocol.Tls;
+
+namespace Mono.Security.Protocol.Tls.Alerts
+{
+       internal class TlsCloseNotifyAlert : TlsAlert
+       {
+               public TlsCloseNotifyAlert(TlsSession session) 
+                       : base(session,  
+                                       TlsAlertLevel.Warning, 
+                                       TlsAlertDescription.CloseNotify)
+               {
+               }
+
+               public override void UpdateSession()
+               {
+                       this.Session.Context.ConnectionEnd = true;
+               }       
+       }
+}
index 6ca3534d712f7758b249fca33e9a13a4fe314967..3486e43609c7b60618d29f151031aa9b3f317f14 100644 (file)
@@ -1,71 +1,71 @@
-/* Transport Security Layer (TLS)\r
- * Copyright (c) 2003 Carlos Guzmán Álvarez\r
- * \r
- * Permission is hereby granted, free of charge, to any person \r
- * obtaining a copy of this software and associated documentation \r
- * files (the "Software"), to deal in the Software without restriction, \r
- * including without limitation the rights to use, copy, modify, merge, \r
- * publish, distribute, sublicense, and/or sell copies of the Software, \r
- * and to permit persons to whom the Software is furnished to do so, \r
- * subject to the following conditions:\r
- * \r
- * The above copyright notice and this permission notice shall be included \r
- * in all copies or substantial portions of the Software.\r
- * \r
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, \r
- * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES \r
- * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND \r
- * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT \r
- * HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, \r
- * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, \r
- * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER \r
- * DEALINGS IN THE SOFTWARE.\r
- */\r
-\r
-using System;\r
-\r
-namespace Mono.Security.Protocol.Tls.Alerts\r
-{\r
-       public delegate void TlsWarningAlertEventHandler(object sender, TlsWarningAlertEventArgs e);\r
-\r
-       public sealed class TlsWarningAlertEventArgs\r
-       {\r
-               #region FIELDS\r
-\r
-               private TlsAlertLevel           level;\r
-               private TlsAlertDescription description;\r
-               private string                          message;\r
-\r
-               #endregion\r
-\r
-               #region PROPERTIES\r
-\r
-               public TlsAlertLevel Level\r
-               {\r
-                       get { return level; }\r
-               }\r
-\r
-               public TlsAlertDescription Description\r
-               {\r
-                       get { return description; }\r
-               }\r
-\r
-               public string Message\r
-               {\r
-                       get { return message; }\r
-               }\r
-\r
-               #endregion\r
-\r
-               #region CONSTRUCTORS\r
-               \r
-               internal TlsWarningAlertEventArgs(TlsAlertLevel level, TlsAlertDescription description)\r
-               {\r
-                       this.level                      = level;\r
-                       this.description        = description;\r
-                       this.message            = TlsAlert.GetAlertMessage(description);\r
-               }\r
-\r
-               #endregion\r
-       }\r
-}\r
+/* Transport Security Layer (TLS)
+ * Copyright (c) 2003 Carlos Guzmán Álvarez
+ * 
+ * Permission is hereby granted, free of charge, to any person 
+ * obtaining a copy of this software and associated documentation 
+ * files (the "Software"), to deal in the Software without restriction, 
+ * including without limitation the rights to use, copy, modify, merge, 
+ * publish, distribute, sublicense, and/or sell copies of the Software, 
+ * and to permit persons to whom the Software is furnished to do so, 
+ * subject to the following conditions:
+ * 
+ * The above copyright notice and this permission notice shall be included 
+ * in all copies or substantial portions of the Software.
+ * 
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 
+ * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES 
+ * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 
+ * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT 
+ * HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, 
+ * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER 
+ * DEALINGS IN THE SOFTWARE.
+ */
+
+using System;
+
+namespace Mono.Security.Protocol.Tls.Alerts
+{
+       public delegate void TlsWarningAlertEventHandler(object sender, TlsWarningAlertEventArgs e);
+
+       public sealed class TlsWarningAlertEventArgs
+       {
+               #region FIELDS
+
+               private TlsAlertLevel           level;
+               private TlsAlertDescription description;
+               private string                          message;
+
+               #endregion
+
+               #region PROPERTIES
+
+               public TlsAlertLevel Level
+               {
+                       get { return level; }
+               }
+
+               public TlsAlertDescription Description
+               {
+                       get { return description; }
+               }
+
+               public string Message
+               {
+                       get { return message; }
+               }
+
+               #endregion
+
+               #region CONSTRUCTORS
+               
+               internal TlsWarningAlertEventArgs(TlsAlertLevel level, TlsAlertDescription description)
+               {
+                       this.level                      = level;
+                       this.description        = description;
+                       this.message            = TlsAlert.GetAlertMessage(description);
+               }
+
+               #endregion
+       }
+}
index 8a2848c2702cb4d34609f28e9208f8c9689229cf..94900630ab7c0daa3c2e86cacb1e5370429b0a11 100644 (file)
@@ -1,37 +1,37 @@
-/* Transport Security Layer (TLS)\r
- * Copyright (c) 2003 Carlos Guzmán Álvarez\r
- * \r
- * Permission is hereby granted, free of charge, to any person \r
- * obtaining a copy of this software and associated documentation \r
- * files (the "Software"), to deal in the Software without restriction, \r
- * including without limitation the rights to use, copy, modify, merge, \r
- * publish, distribute, sublicense, and/or sell copies of the Software, \r
- * and to permit persons to whom the Software is furnished to do so, \r
- * subject to the following conditions:\r
- * \r
- * The above copyright notice and this permission notice shall be included \r
- * in all copies or substantial portions of the Software.\r
- * \r
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, \r
- * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES \r
- * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND \r
- * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT \r
- * HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, \r
- * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, \r
- * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER \r
- * DEALINGS IN THE SOFTWARE.\r
- */\r
-\r
-using System;\r
-\r
-namespace Mono.Security.Protocol.Tls.Handshake\r
-{\r
-       internal enum TlsClientCertificateType\r
-       {\r
-               RSA                     = 1,\r
-               DSS                     = 2,\r
-               RSAFixed        = 3,\r
-               DSSFixed        = 4,\r
-               Unknown         = 255\r
-       }\r
-}\r
+/* Transport Security Layer (TLS)
+ * Copyright (c) 2003 Carlos Guzmán Álvarez
+ * 
+ * Permission is hereby granted, free of charge, to any person 
+ * obtaining a copy of this software and associated documentation 
+ * files (the "Software"), to deal in the Software without restriction, 
+ * including without limitation the rights to use, copy, modify, merge, 
+ * publish, distribute, sublicense, and/or sell copies of the Software, 
+ * and to permit persons to whom the Software is furnished to do so, 
+ * subject to the following conditions:
+ * 
+ * The above copyright notice and this permission notice shall be included 
+ * in all copies or substantial portions of the Software.
+ * 
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 
+ * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES 
+ * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 
+ * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT 
+ * HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, 
+ * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER 
+ * DEALINGS IN THE SOFTWARE.
+ */
+
+using System;
+
+namespace Mono.Security.Protocol.Tls.Handshake
+{
+       internal enum TlsClientCertificateType
+       {
+               RSA                     = 1,
+               DSS                     = 2,
+               RSAFixed        = 3,
+               DSSFixed        = 4,
+               Unknown         = 255
+       }
+}
index a7f7428441bad8eb505825d4695b7f15b9914b95..adf66115b07ec1848cd93b2e64ae810eeeb0e4a1 100644 (file)
@@ -1,98 +1,98 @@
-/* Transport Security Layer (TLS)\r
- * Copyright (c) 2003 Carlos Guzmán Álvarez\r
- * \r
- * Permission is hereby granted, free of charge, to any person \r
- * obtaining a copy of this software and associated documentation \r
- * files (the "Software"), to deal in the Software without restriction, \r
- * including without limitation the rights to use, copy, modify, merge, \r
- * publish, distribute, sublicense, and/or sell copies of the Software, \r
- * and to permit persons to whom the Software is furnished to do so, \r
- * subject to the following conditions:\r
- * \r
- * The above copyright notice and this permission notice shall be included \r
- * in all copies or substantial portions of the Software.\r
- * \r
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, \r
- * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES \r
- * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND \r
- * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT \r
- * HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, \r
- * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, \r
- * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER \r
- * DEALINGS IN THE SOFTWARE.\r
- */\r
-\r
-using System;\r
-using System.Security.Cryptography;\r
-\r
-namespace Mono.Security.Protocol.Tls.Handshake\r
-{\r
-       internal class TlsHandshakeHashes\r
-       {\r
-               #region FIELDS\r
-\r
-               private MD5CryptoServiceProvider        md5;\r
-               private SHA1CryptoServiceProvider       sha;\r
-               private TlsStream                                       messages;\r
-\r
-               #endregion\r
-\r
-               #region CONSTRUCTORS\r
-\r
-               public TlsHandshakeHashes()\r
-               {\r
-                       this.messages   = new TlsStream();\r
-                       this.md5                = new MD5CryptoServiceProvider();\r
-                       this.sha                = new SHA1CryptoServiceProvider();\r
-               }\r
-\r
-               #endregion\r
-\r
-               #region METHODS\r
-\r
-               public void Update(byte[] message)\r
-               {\r
-                       byte[] tmp = new byte[message.Length];\r
-\r
-                       md5.TransformBlock(message, 0, message.Length, tmp, 0);\r
-                       sha.TransformBlock(message, 0, message.Length, tmp, 0);\r
-\r
-                       this.messages.Write(message);\r
-               }\r
-\r
-               public byte[] GetMD5Hash()\r
-               {\r
-                       md5.TransformFinalBlock(new byte[0], 0, 0);\r
-               \r
-                       return md5.Hash;\r
-               }\r
-\r
-               public byte[] GetSHAHash()\r
-               {\r
-                       sha.TransformFinalBlock(new byte[0], 0, 0);\r
-               \r
-                       return sha.Hash;\r
-               }\r
-\r
-               public void Reset()\r
-               {\r
-                       md5.Initialize();\r
-                       sha.Initialize();\r
-\r
-                       byte[] tmp = new byte[messages.Length];\r
-                       \r
-                       md5.TransformBlock(messages.ToArray(), 0, tmp.Length, tmp, 0);\r
-                       sha.TransformBlock(messages.ToArray(), 0, tmp.Length, tmp, 0);\r
-               }\r
-\r
-               public void Clear()\r
-               {\r
-                       md5.Initialize();\r
-                       sha.Initialize();\r
-\r
-                       messages.Reset();\r
-               }\r
-\r
-               #endregion\r
-       }\r
-}\r
+/* Transport Security Layer (TLS)
+ * Copyright (c) 2003 Carlos Guzmán Álvarez
+ * 
+ * Permission is hereby granted, free of charge, to any person 
+ * obtaining a copy of this software and associated documentation 
+ * files (the "Software"), to deal in the Software without restriction, 
+ * including without limitation the rights to use, copy, modify, merge, 
+ * publish, distribute, sublicense, and/or sell copies of the Software, 
+ * and to permit persons to whom the Software is furnished to do so, 
+ * subject to the following conditions:
+ * 
+ * The above copyright notice and this permission notice shall be included 
+ * in all copies or substantial portions of the Software.
+ * 
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 
+ * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES 
+ * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 
+ * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT 
+ * HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, 
+ * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER 
+ * DEALINGS IN THE SOFTWARE.
+ */
+
+using System;
+using System.Security.Cryptography;
+
+namespace Mono.Security.Protocol.Tls.Handshake
+{
+       internal class TlsHandshakeHashes
+       {
+               #region FIELDS
+
+               private MD5CryptoServiceProvider        md5;
+               private SHA1CryptoServiceProvider       sha;
+               private TlsStream                                       messages;
+
+               #endregion
+
+               #region CONSTRUCTORS
+
+               public TlsHandshakeHashes()
+               {
+                       this.messages   = new TlsStream();
+                       this.md5                = new MD5CryptoServiceProvider();
+                       this.sha                = new SHA1CryptoServiceProvider();
+               }
+
+               #endregion
+
+               #region METHODS
+
+               public void Update(byte[] message)
+               {
+                       byte[] tmp = new byte[message.Length];
+
+                       md5.TransformBlock(message, 0, message.Length, tmp, 0);
+                       sha.TransformBlock(message, 0, message.Length, tmp, 0);
+
+                       this.messages.Write(message);
+               }
+
+               public byte[] GetMD5Hash()
+               {
+                       md5.TransformFinalBlock(new byte[0], 0, 0);
+               
+                       return md5.Hash;
+               }
+
+               public byte[] GetSHAHash()
+               {
+                       sha.TransformFinalBlock(new byte[0], 0, 0);
+               
+                       return sha.Hash;
+               }
+
+               public void Reset()
+               {
+                       md5.Initialize();
+                       sha.Initialize();
+
+                       byte[] tmp = new byte[messages.Length];
+                       
+                       md5.TransformBlock(messages.ToArray(), 0, tmp.Length, tmp, 0);
+                       sha.TransformBlock(messages.ToArray(), 0, tmp.Length, tmp, 0);
+               }
+
+               public void Clear()
+               {
+                       md5.Initialize();
+                       sha.Initialize();
+
+                       messages.Reset();
+               }
+
+               #endregion
+       }
+}
index ce341840b6164e96c22bd42609c77fe77a8b71db..6dbbe045d1e40a5c0a1e3c4ff171c684939b8d6c 100644 (file)
@@ -1,43 +1,43 @@
-/* Transport Security Layer (TLS)\r
- * Copyright (c) 2003 Carlos Guzmán Álvarez\r
- * \r
- * Permission is hereby granted, free of charge, to any person \r
- * obtaining a copy of this software and associated documentation \r
- * files (the "Software"), to deal in the Software without restriction, \r
- * including without limitation the rights to use, copy, modify, merge, \r
- * publish, distribute, sublicense, and/or sell copies of the Software, \r
- * and to permit persons to whom the Software is furnished to do so, \r
- * subject to the following conditions:\r
- * \r
- * The above copyright notice and this permission notice shall be included \r
- * in all copies or substantial portions of the Software.\r
- * \r
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, \r
- * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES \r
- * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND \r
- * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT \r
- * HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, \r
- * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, \r
- * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER \r
- * DEALINGS IN THE SOFTWARE.\r
- */\r
-\r
-using System;\r
-\r
-namespace Mono.Security.Protocol.Tls.Handshake\r
-{\r
-       internal enum TlsHandshakeType : byte\r
-       {\r
-               HelloRequest            = 0,\r
-               ClientHello                     = 1,\r
-               ServerHello                     = 2,\r
-               Certificate                     = 11,\r
-               ServerKeyExchange       = 12,\r
-               CertificateRequest      = 13,\r
-               ServerHelloDone         = 14,\r
-               CertificateVerify       = 15,\r
-               ClientKeyExchange       = 16,\r
-               Finished                        = 20,\r
-               Unknown                         = 255\r
-       }\r
-}\r
+/* Transport Security Layer (TLS)
+ * Copyright (c) 2003 Carlos Guzmán Álvarez
+ * 
+ * Permission is hereby granted, free of charge, to any person 
+ * obtaining a copy of this software and associated documentation 
+ * files (the "Software"), to deal in the Software without restriction, 
+ * including without limitation the rights to use, copy, modify, merge, 
+ * publish, distribute, sublicense, and/or sell copies of the Software, 
+ * and to permit persons to whom the Software is furnished to do so, 
+ * subject to the following conditions:
+ * 
+ * The above copyright notice and this permission notice shall be included 
+ * in all copies or substantial portions of the Software.
+ * 
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 
+ * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES 
+ * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 
+ * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT 
+ * HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, 
+ * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER 
+ * DEALINGS IN THE SOFTWARE.
+ */
+
+using System;
+
+namespace Mono.Security.Protocol.Tls.Handshake
+{
+       internal enum TlsHandshakeType : byte
+       {
+               HelloRequest            = 0,
+               ClientHello                     = 1,
+               ServerHello                     = 2,
+               Certificate                     = 11,
+               ServerKeyExchange       = 12,
+               CertificateRequest      = 13,
+               ServerHelloDone         = 14,
+               CertificateVerify       = 15,
+               ClientKeyExchange       = 16,
+               Finished                        = 20,
+               Unknown                         = 255
+       }
+}
index efcd074657225d41c47782aceeb5aab9f6378b17..6856cd9bdd6ce3a91ea4f4be0eac7691a196218a 100644 (file)
@@ -1,39 +1,39 @@
-/* Transport Security Layer (TLS)\r
- * Copyright (c) 2003 Carlos Guzmán Álvarez\r
- * \r
- * Permission is hereby granted, free of charge, to any person \r
- * obtaining a copy of this software and associated documentation \r
- * files (the "Software"), to deal in the Software without restriction, \r
- * including without limitation the rights to use, copy, modify, merge, \r
- * publish, distribute, sublicense, and/or sell copies of the Software, \r
- * and to permit persons to whom the Software is furnished to do so, \r
- * subject to the following conditions:\r
- * \r
- * The above copyright notice and this permission notice shall be included \r
- * in all copies or substantial portions of the Software.\r
- * \r
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, \r
- * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES \r
- * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND \r
- * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT \r
- * HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, \r
- * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, \r
- * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER \r
- * DEALINGS IN THE SOFTWARE.\r
- */\r
-\r
-using System;\r
-\r
-namespace Mono.Security.Protocol.Tls\r
-{\r
-       public enum TlsSessionState\r
-       {\r
-               Broken,\r
-               Open,           \r
-               Closed,         \r
-               OpenSecure,\r
-               OpeningSecure,\r
-               Opening,\r
-               Closing\r
-       }\r
-}\r
+/* Transport Security Layer (TLS)
+ * Copyright (c) 2003 Carlos Guzmán Álvarez
+ * 
+ * Permission is hereby granted, free of charge, to any person 
+ * obtaining a copy of this software and associated documentation 
+ * files (the "Software"), to deal in the Software without restriction, 
+ * including without limitation the rights to use, copy, modify, merge, 
+ * publish, distribute, sublicense, and/or sell copies of the Software, 
+ * and to permit persons to whom the Software is furnished to do so, 
+ * subject to the following conditions:
+ * 
+ * The above copyright notice and this permission notice shall be included 
+ * in all copies or substantial portions of the Software.
+ * 
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 
+ * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES 
+ * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 
+ * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT 
+ * HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, 
+ * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER 
+ * DEALINGS IN THE SOFTWARE.
+ */
+
+using System;
+
+namespace Mono.Security.Protocol.Tls
+{
+       public enum TlsSessionState
+       {
+               Broken,
+               Open,           
+               Closed,         
+               OpenSecure,
+               OpeningSecure,
+               Opening,
+               Closing
+       }
+}