summary refs log tree commit diff
path: root/crypto/src/tls
diff options
context:
space:
mode:
authorPeter Dettman <peter.dettman@bouncycastle.org>2022-06-24 15:07:29 +0700
committerPeter Dettman <peter.dettman@bouncycastle.org>2022-06-24 15:07:29 +0700
commitb72579c4b1200459f959bcd6a25364e239420573 (patch)
tree5e566cc2b7972cd8ccebece92d879bddc800393d /crypto/src/tls
parentRemove certpath from PkixCertPathValidatorException (diff)
downloadBouncyCastle.NET-ed25519-b72579c4b1200459f959bcd6a25364e239420573.tar.xz
Cleanup Exception classes
Diffstat (limited to 'crypto/src/tls')
-rw-r--r--crypto/src/tls/TlsException.cs35
-rw-r--r--crypto/src/tls/TlsFatalAlert.cs7
-rw-r--r--crypto/src/tls/TlsFatalAlertReceived.cs7
-rw-r--r--crypto/src/tls/TlsNoCloseNotifyException.cs9
-rw-r--r--crypto/src/tls/TlsTimeoutException.cs35
-rw-r--r--crypto/src/tls/crypto/TlsCryptoException.cs34
6 files changed, 87 insertions, 40 deletions
diff --git a/crypto/src/tls/TlsException.cs b/crypto/src/tls/TlsException.cs
index c6d7a1916..9c6d74bf4 100644
--- a/crypto/src/tls/TlsException.cs
+++ b/crypto/src/tls/TlsException.cs
@@ -1,24 +1,31 @@
 using System;
 using System.IO;
+using System.Runtime.Serialization;
 
 namespace Org.BouncyCastle.Tls
 {
-    public class TlsException
+	[Serializable]
+	public class TlsException
         : IOException
     {
-        public TlsException()
-            : base()
-        {
-        }
+		public TlsException()
+			: base()
+		{
+		}
 
-        public TlsException(string message)
-            : base(message)
-        {
-        }
+		public TlsException(string message)
+			: base(message)
+		{
+		}
 
-        public TlsException(string message, Exception cause)
-            : base(message, cause)
-        {
-        }
-    }
+		public TlsException(string message, Exception innerException)
+			: base(message, innerException)
+		{
+		}
+
+		protected TlsException(SerializationInfo info, StreamingContext context)
+			: base(info, context)
+		{
+		}
+	}
 }
diff --git a/crypto/src/tls/TlsFatalAlert.cs b/crypto/src/tls/TlsFatalAlert.cs
index 9f0ea8f30..511fa9fb1 100644
--- a/crypto/src/tls/TlsFatalAlert.cs
+++ b/crypto/src/tls/TlsFatalAlert.cs
@@ -1,7 +1,9 @@
 using System;
+using System.Runtime.Serialization;
 
 namespace Org.BouncyCastle.Tls
 {
+    [Serializable]
     public class TlsFatalAlert
         : TlsException
     {
@@ -38,6 +40,11 @@ namespace Org.BouncyCastle.Tls
             this.m_alertDescription = alertDescription;
         }
 
+        protected TlsFatalAlert(SerializationInfo info, StreamingContext context)
+            : base(info, context)
+        {
+        }
+
         public virtual short AlertDescription
         {
             get { return m_alertDescription; }
diff --git a/crypto/src/tls/TlsFatalAlertReceived.cs b/crypto/src/tls/TlsFatalAlertReceived.cs
index 0bf6cff38..adf71d5b9 100644
--- a/crypto/src/tls/TlsFatalAlertReceived.cs
+++ b/crypto/src/tls/TlsFatalAlertReceived.cs
@@ -1,7 +1,9 @@
 using System;
+using System.Runtime.Serialization;
 
 namespace Org.BouncyCastle.Tls
 {
+    [Serializable]
     public class TlsFatalAlertReceived
         : TlsException
     {
@@ -13,6 +15,11 @@ namespace Org.BouncyCastle.Tls
             this.m_alertDescription = alertDescription;
         }
 
+        protected TlsFatalAlertReceived(SerializationInfo info, StreamingContext context)
+            : base(info, context)
+        {
+        }
+
         public virtual short AlertDescription
         {
             get { return m_alertDescription; }
diff --git a/crypto/src/tls/TlsNoCloseNotifyException.cs b/crypto/src/tls/TlsNoCloseNotifyException.cs
index 8fdfbbfc4..b0314a406 100644
--- a/crypto/src/tls/TlsNoCloseNotifyException.cs
+++ b/crypto/src/tls/TlsNoCloseNotifyException.cs
@@ -1,5 +1,6 @@
 using System;
 using System.IO;
+using System.Runtime.Serialization;
 
 namespace Org.BouncyCastle.Tls
 {
@@ -10,6 +11,7 @@ namespace Org.BouncyCastle.Tls
     /// malicious). It may be possible to check for truncation via some property of a higher level protocol
     /// built upon TLS, e.g.the Content-Length header for HTTPS.
     /// </remarks>
+    [Serializable]
     public class TlsNoCloseNotifyException
         : EndOfStreamException
     {
@@ -17,5 +19,10 @@ namespace Org.BouncyCastle.Tls
             : base("No close_notify alert received before connection closed")
         {
         }
-    }
+
+		protected TlsNoCloseNotifyException(SerializationInfo info, StreamingContext context)
+			: base(info, context)
+		{
+		}
+	}
 }
diff --git a/crypto/src/tls/TlsTimeoutException.cs b/crypto/src/tls/TlsTimeoutException.cs
index ce2e1ac63..669352f54 100644
--- a/crypto/src/tls/TlsTimeoutException.cs
+++ b/crypto/src/tls/TlsTimeoutException.cs
@@ -1,24 +1,31 @@
 using System;
 using System.IO;
+using System.Runtime.Serialization;
 
 namespace Org.BouncyCastle.Tls
 {
-    public class TlsTimeoutException
+	[Serializable]
+	public class TlsTimeoutException
         : IOException
     {
-        public TlsTimeoutException()
-            : base()
-        {
-        }
+		public TlsTimeoutException()
+			: base()
+		{
+		}
 
-        public TlsTimeoutException(string message)
-            : base(message)
-        {
-        }
+		public TlsTimeoutException(string message)
+			: base(message)
+		{
+		}
 
-        public TlsTimeoutException(string message, Exception cause)
-            : base(message, cause)
-        {
-        }
-    }
+		public TlsTimeoutException(string message, Exception innerException)
+			: base(message, innerException)
+		{
+		}
+
+		protected TlsTimeoutException(SerializationInfo info, StreamingContext context)
+			: base(info, context)
+		{
+		}
+	}
 }
diff --git a/crypto/src/tls/crypto/TlsCryptoException.cs b/crypto/src/tls/crypto/TlsCryptoException.cs
index 83c3ef791..9498ddf3a 100644
--- a/crypto/src/tls/crypto/TlsCryptoException.cs
+++ b/crypto/src/tls/crypto/TlsCryptoException.cs
@@ -1,19 +1,31 @@
 using System;
+using System.Runtime.Serialization;
 
 namespace Org.BouncyCastle.Tls.Crypto
 {
-    /// <summary>Basic exception class for crypto services to pass back a cause.</summary>
-    public class TlsCryptoException
+	/// <summary>Basic exception class for crypto services to pass back a cause.</summary>
+	[Serializable]
+	public class TlsCryptoException
         : TlsException
     {
-        public TlsCryptoException(string msg)
-            : base(msg)
-        {
-        }
+		public TlsCryptoException()
+			: base()
+		{
+		}
 
-        public TlsCryptoException(string msg, Exception cause)
-            : base(msg, cause)
-        {
-        }
-    }
+		public TlsCryptoException(string message)
+			: base(message)
+		{
+		}
+
+		public TlsCryptoException(string message, Exception innerException)
+			: base(message, innerException)
+		{
+		}
+
+		protected TlsCryptoException(SerializationInfo info, StreamingContext context)
+			: base(info, context)
+		{
+		}
+	}
 }