summary refs log tree commit diff
path: root/crypto/src/tsp/TSPValidationException.cs
diff options
context:
space:
mode:
authorPeter Dettman <peter.dettman@bouncycastle.org>2022-07-01 16:04:26 +0700
committerPeter Dettman <peter.dettman@bouncycastle.org>2022-07-01 16:04:26 +0700
commit7667960b24e63b23518408337c69d5f36c5dfd94 (patch)
tree5a4d0d42d37cd2413b3ec7b68eccfb16f3d4a858 /crypto/src/tsp/TSPValidationException.cs
parentRework EdDSA precomputations (diff)
downloadBouncyCastle.NET-ed25519-7667960b24e63b23518408337c69d5f36c5dfd94.tar.xz
Custom serialization
Diffstat (limited to 'crypto/src/tsp/TSPValidationException.cs')
-rw-r--r--crypto/src/tsp/TSPValidationException.cs16
1 files changed, 11 insertions, 5 deletions
diff --git a/crypto/src/tsp/TSPValidationException.cs b/crypto/src/tsp/TSPValidationException.cs
index eb5181f2e..ca693fa38 100644
--- a/crypto/src/tsp/TSPValidationException.cs
+++ b/crypto/src/tsp/TSPValidationException.cs
@@ -13,29 +13,35 @@ namespace Org.BouncyCastle.Tsp
     public class TspValidationException
 		: TspException
 	{
-		private int failureCode;
+		protected readonly int m_failureCode;
 
 		public TspValidationException(string message)
-			: base(message)
+			: this(message, -1)
 		{
-			this.failureCode = -1;
 		}
 
 		public TspValidationException(string message, int failureCode)
 			: base(message)
 		{
-			this.failureCode = failureCode;
+			m_failureCode = failureCode;
 		}
 
 		protected TspValidationException(SerializationInfo info, StreamingContext context)
 			: base(info, context)
 		{
+			m_failureCode = info.GetInt32("failureCode");
+		}
+
+		public override void GetObjectData(SerializationInfo info, StreamingContext context)
+		{
+			base.GetObjectData(info, context);
+			info.AddValue("failureCode", m_failureCode);
 		}
 
 		/// <returns>The failure code associated with this exception, if one is set.</returns>
 		public int FailureCode
 		{
-			get { return failureCode; }
+			get { return m_failureCode; }
 		}
 	}
 }