From b72579c4b1200459f959bcd6a25364e239420573 Mon Sep 17 00:00:00 2001
From: Peter Dettman
Date: Fri, 24 Jun 2022 15:07:29 +0700
Subject: Cleanup Exception classes
---
crypto/src/asn1/Asn1Exception.cs | 17 ++++----
crypto/src/asn1/Asn1ParsingException.cs | 17 ++++----
.../src/bcpg/UnsupportedPacketVersionException.cs | 25 +++++++++--
crypto/src/cmp/CmpException.cs | 8 ++++
.../cms/CMSAttributeTableGenerationException.cs | 34 ++++++++-------
crypto/src/cms/CMSException.cs | 20 +++++----
crypto/src/cms/CMSStreamException.cs | 30 +++++++------
crypto/src/crmf/CrmfException.cs | 34 +++++++++------
crypto/src/crypto/CryptoException.cs | 34 ++++++++-------
crypto/src/crypto/DataLengthException.cs | 51 ++++++++++------------
crypto/src/crypto/InvalidCipherTextException.cs | 47 ++++++++------------
crypto/src/crypto/MaxBytesExceededException.cs | 23 +++++-----
crypto/src/crypto/OutputLengthException.cs | 36 +++++++--------
crypto/src/ocsp/OCSPException.cs | 18 ++++----
crypto/src/openpgp/PgpDataValidationException.cs | 29 ++++++++----
crypto/src/openpgp/PgpException.cs | 27 +++++++++---
crypto/src/openpgp/PgpKeyValidationException.cs | 29 ++++++++----
crypto/src/openssl/EncryptionException.cs | 22 ++++++----
crypto/src/openssl/PEMException.cs | 22 ++++++----
crypto/src/openssl/PasswordException.cs | 22 ++++++----
crypto/src/pkcs/PkcsException.cs | 36 +++++++++------
crypto/src/pkcs/PkcsIOException.cs | 35 ++++++++++-----
crypto/src/pkix/PkixCertPathBuilderException.cs | 32 +++++++++-----
crypto/src/pkix/PkixCertPathValidatorException.cs | 10 ++---
.../pkix/PkixNameConstraintValidatorException.cs | 26 ++++++++---
crypto/src/pqc/crypto/lms/LMSException.cs | 34 +++++++++------
crypto/src/security/GeneralSecurityException.cs | 4 +-
crypto/src/security/InvalidKeyException.cs | 28 +++++++++---
crypto/src/security/InvalidParameterException.cs | 28 +++++++++---
crypto/src/security/KeyException.cs | 28 +++++++++---
crypto/src/security/SecurityUtilityException.cs | 42 ++++++++----------
crypto/src/security/SignatureException.cs | 28 +++++++++---
.../security/cert/CertificateEncodingException.cs | 28 +++++++++---
crypto/src/security/cert/CertificateException.cs | 28 +++++++++---
.../security/cert/CertificateExpiredException.cs | 28 +++++++++---
.../cert/CertificateNotYetValidException.cs | 28 +++++++++---
.../security/cert/CertificateParsingException.cs | 28 +++++++++---
crypto/src/security/cert/CrlException.cs | 28 +++++++++---
crypto/src/tls/TlsException.cs | 35 +++++++++------
crypto/src/tls/TlsFatalAlert.cs | 7 +++
crypto/src/tls/TlsFatalAlertReceived.cs | 7 +++
crypto/src/tls/TlsNoCloseNotifyException.cs | 9 +++-
crypto/src/tls/TlsTimeoutException.cs | 35 +++++++++------
crypto/src/tls/crypto/TlsCryptoException.cs | 34 ++++++++++-----
crypto/src/tsp/TSPException.cs | 18 ++++----
crypto/src/tsp/TSPValidationException.cs | 21 ++++-----
crypto/src/util/MemoableResetException.cs | 35 ++++++++++-----
crypto/src/util/io/StreamOverflowException.cs | 17 ++++----
crypto/src/util/io/pem/PemGenerationException.cs | 17 ++++----
crypto/src/x509/store/NoSuchStoreException.cs | 18 ++++----
crypto/src/x509/store/X509StoreException.cs | 18 ++++----
crypto/test/src/util/test/SimpleTest.cs | 2 +-
crypto/test/src/util/test/TestFailedException.cs | 15 +++----
53 files changed, 846 insertions(+), 486 deletions(-)
diff --git a/crypto/src/asn1/Asn1Exception.cs b/crypto/src/asn1/Asn1Exception.cs
index 9e4afb49f..ae89bbcdc 100644
--- a/crypto/src/asn1/Asn1Exception.cs
+++ b/crypto/src/asn1/Asn1Exception.cs
@@ -1,11 +1,10 @@
using System;
using System.IO;
+using System.Runtime.Serialization;
namespace Org.BouncyCastle.Asn1
{
-#if !PORTABLE
[Serializable]
-#endif
public class Asn1Exception
: IOException
{
@@ -14,16 +13,18 @@ namespace Org.BouncyCastle.Asn1
{
}
- public Asn1Exception(
- string message)
+ public Asn1Exception(string message)
: base(message)
{
}
- public Asn1Exception(
- string message,
- Exception exception)
- : base(message, exception)
+ public Asn1Exception(string message, Exception innerException)
+ : base(message, innerException)
+ {
+ }
+
+ protected Asn1Exception(SerializationInfo info, StreamingContext context)
+ : base(info, context)
{
}
}
diff --git a/crypto/src/asn1/Asn1ParsingException.cs b/crypto/src/asn1/Asn1ParsingException.cs
index 294e4c2c9..2b54ae0a1 100644
--- a/crypto/src/asn1/Asn1ParsingException.cs
+++ b/crypto/src/asn1/Asn1ParsingException.cs
@@ -1,10 +1,9 @@
using System;
+using System.Runtime.Serialization;
namespace Org.BouncyCastle.Asn1
{
-#if !PORTABLE
[Serializable]
-#endif
public class Asn1ParsingException
: InvalidOperationException
{
@@ -13,16 +12,18 @@ namespace Org.BouncyCastle.Asn1
{
}
- public Asn1ParsingException(
- string message)
+ public Asn1ParsingException(string message)
: base(message)
{
}
- public Asn1ParsingException(
- string message,
- Exception exception)
- : base(message, exception)
+ public Asn1ParsingException(string message, Exception innerException)
+ : base(message, innerException)
+ {
+ }
+
+ protected Asn1ParsingException(SerializationInfo info, StreamingContext context)
+ : base(info, context)
{
}
}
diff --git a/crypto/src/bcpg/UnsupportedPacketVersionException.cs b/crypto/src/bcpg/UnsupportedPacketVersionException.cs
index 447d75286..d59404f7a 100644
--- a/crypto/src/bcpg/UnsupportedPacketVersionException.cs
+++ b/crypto/src/bcpg/UnsupportedPacketVersionException.cs
@@ -1,13 +1,30 @@
using System;
+using System.Runtime.Serialization;
namespace Org.BouncyCastle.Bcpg
{
+ [Serializable]
public class UnsupportedPacketVersionException
: Exception
{
- public UnsupportedPacketVersionException(string msg)
- : base(msg)
- {
- }
+ public UnsupportedPacketVersionException()
+ : base()
+ {
+ }
+
+ public UnsupportedPacketVersionException(string message)
+ : base(message)
+ {
+ }
+
+ public UnsupportedPacketVersionException(string message, Exception innerException)
+ : base(message, innerException)
+ {
+ }
+
+ protected UnsupportedPacketVersionException(SerializationInfo info, StreamingContext context)
+ : base(info, context)
+ {
+ }
}
}
diff --git a/crypto/src/cmp/CmpException.cs b/crypto/src/cmp/CmpException.cs
index 6594e8f2a..6d3271a20 100644
--- a/crypto/src/cmp/CmpException.cs
+++ b/crypto/src/cmp/CmpException.cs
@@ -1,11 +1,14 @@
using System;
+using System.Runtime.Serialization;
namespace Org.BouncyCastle.Cmp
{
+ [Serializable]
public class CmpException
: Exception
{
public CmpException()
+ : base()
{
}
@@ -18,5 +21,10 @@ namespace Org.BouncyCastle.Cmp
: base(message, innerException)
{
}
+
+ protected CmpException(SerializationInfo info, StreamingContext context)
+ : base(info, context)
+ {
+ }
}
}
diff --git a/crypto/src/cms/CMSAttributeTableGenerationException.cs b/crypto/src/cms/CMSAttributeTableGenerationException.cs
index 692be2804..977d60e5c 100644
--- a/crypto/src/cms/CMSAttributeTableGenerationException.cs
+++ b/crypto/src/cms/CMSAttributeTableGenerationException.cs
@@ -1,28 +1,30 @@
using System;
+using System.Runtime.Serialization;
namespace Org.BouncyCastle.Cms
{
-#if !PORTABLE
[Serializable]
-#endif
public class CmsAttributeTableGenerationException
: CmsException
{
- public CmsAttributeTableGenerationException()
- {
- }
+ public CmsAttributeTableGenerationException()
+ : base()
+ {
+ }
- public CmsAttributeTableGenerationException(
- string name)
- : base(name)
- {
- }
+ public CmsAttributeTableGenerationException(string message)
+ : base(message)
+ {
+ }
- public CmsAttributeTableGenerationException(
- string name,
- Exception e)
- : base(name, e)
- {
- }
+ public CmsAttributeTableGenerationException(string message, Exception innerException)
+ : base(message, innerException)
+ {
+ }
+
+ protected CmsAttributeTableGenerationException(SerializationInfo info, StreamingContext context)
+ : base(info, context)
+ {
+ }
}
}
diff --git a/crypto/src/cms/CMSException.cs b/crypto/src/cms/CMSException.cs
index 83de3f00e..eab32f916 100644
--- a/crypto/src/cms/CMSException.cs
+++ b/crypto/src/cms/CMSException.cs
@@ -1,27 +1,29 @@
using System;
+using System.Runtime.Serialization;
namespace Org.BouncyCastle.Cms
{
-#if !PORTABLE
[Serializable]
-#endif
public class CmsException
: Exception
{
public CmsException()
+ : base()
{
}
- public CmsException(
- string msg)
- : base(msg)
+ public CmsException(string message)
+ : base(message)
{
}
- public CmsException(
- string msg,
- Exception e)
- : base(msg, e)
+ public CmsException(string message, Exception innerException)
+ : base(message, innerException)
+ {
+ }
+
+ protected CmsException(SerializationInfo info, StreamingContext context)
+ : base(info, context)
{
}
}
diff --git a/crypto/src/cms/CMSStreamException.cs b/crypto/src/cms/CMSStreamException.cs
index c3b0f9621..42ae409f7 100644
--- a/crypto/src/cms/CMSStreamException.cs
+++ b/crypto/src/cms/CMSStreamException.cs
@@ -1,29 +1,31 @@
using System;
using System.IO;
+using System.Runtime.Serialization;
namespace Org.BouncyCastle.Cms
{
-#if !PORTABLE
[Serializable]
-#endif
public class CmsStreamException
: IOException
{
public CmsStreamException()
+ : base()
{
}
- public CmsStreamException(
- string name)
- : base(name)
- {
- }
+ public CmsStreamException(string message)
+ : base(message)
+ {
+ }
- public CmsStreamException(
- string name,
- Exception e)
- : base(name, e)
- {
- }
- }
+ public CmsStreamException(string message, Exception innerException)
+ : base(message, innerException)
+ {
+ }
+
+ protected CmsStreamException(SerializationInfo info, StreamingContext context)
+ : base(info, context)
+ {
+ }
+ }
}
diff --git a/crypto/src/crmf/CrmfException.cs b/crypto/src/crmf/CrmfException.cs
index 5ae13a0eb..9b1597400 100644
--- a/crypto/src/crmf/CrmfException.cs
+++ b/crypto/src/crmf/CrmfException.cs
@@ -1,22 +1,30 @@
using System;
+using System.Runtime.Serialization;
namespace Org.BouncyCastle.Crmf
{
- public class CrmfException
+ [Serializable]
+ public class CrmfException
: Exception
{
- public CrmfException()
- {
- }
+ public CrmfException()
+ : base()
+ {
+ }
- public CrmfException(string message)
- : base(message)
- {
- }
+ public CrmfException(string message)
+ : base(message)
+ {
+ }
- public CrmfException(string message, Exception innerException)
- : base(message, innerException)
- {
- }
- }
+ public CrmfException(string message, Exception innerException)
+ : base(message, innerException)
+ {
+ }
+
+ protected CrmfException(SerializationInfo info, StreamingContext context)
+ : base(info, context)
+ {
+ }
+ }
}
diff --git a/crypto/src/crypto/CryptoException.cs b/crypto/src/crypto/CryptoException.cs
index c5ee938c7..e40cfbc04 100644
--- a/crypto/src/crypto/CryptoException.cs
+++ b/crypto/src/crypto/CryptoException.cs
@@ -1,28 +1,30 @@
using System;
+using System.Runtime.Serialization;
namespace Org.BouncyCastle.Crypto
{
-#if !PORTABLE
[Serializable]
-#endif
public class CryptoException
: Exception
{
- public CryptoException()
- {
- }
+ public CryptoException()
+ : base()
+ {
+ }
- public CryptoException(
- string message)
+ public CryptoException(string message)
: base(message)
- {
- }
+ {
+ }
- public CryptoException(
- string message,
- Exception exception)
- : base(message, exception)
- {
- }
- }
+ public CryptoException(string message, Exception innerException)
+ : base(message, innerException)
+ {
+ }
+
+ protected CryptoException(SerializationInfo info, StreamingContext context)
+ : base(info, context)
+ {
+ }
+ }
}
diff --git a/crypto/src/crypto/DataLengthException.cs b/crypto/src/crypto/DataLengthException.cs
index 5dde879d1..909639144 100644
--- a/crypto/src/crypto/DataLengthException.cs
+++ b/crypto/src/crypto/DataLengthException.cs
@@ -1,42 +1,35 @@
using System;
+using System.Runtime.Serialization;
namespace Org.BouncyCastle.Crypto
{
- /**
- * this exception is thrown if a buffer that is meant to have output
- * copied into it turns out to be too short, or if we've been given
- * insufficient input. In general this exception will Get thrown rather
- * than an ArrayOutOfBounds exception.
- */
-#if !PORTABLE
- [Serializable]
-#endif
+ /// This exception is thrown if a buffer that is meant to have output copied into it turns out to be too
+ /// short, or if we've been given insufficient input.
+ ///
+ /// In general this exception will get thrown rather than an .
+ ///
+ [Serializable]
public class DataLengthException
: CryptoException
{
- /**
- * base constructor.
- */
- public DataLengthException()
- {
- }
+ public DataLengthException()
+ : base()
+ {
+ }
- /**
- * create a DataLengthException with the given message.
- *
- * @param message the message to be carried with the exception.
- */
- public DataLengthException(
- string message)
+ public DataLengthException(string message)
: base(message)
- {
+ {
+ }
+
+ public DataLengthException(string message, Exception innerException)
+ : base(message, innerException)
+ {
}
- public DataLengthException(
- string message,
- Exception exception)
- : base(message, exception)
- {
- }
+ protected DataLengthException(SerializationInfo info, StreamingContext context)
+ : base(info, context)
+ {
+ }
}
}
diff --git a/crypto/src/crypto/InvalidCipherTextException.cs b/crypto/src/crypto/InvalidCipherTextException.cs
index 760ef3206..13ac86763 100644
--- a/crypto/src/crypto/InvalidCipherTextException.cs
+++ b/crypto/src/crypto/InvalidCipherTextException.cs
@@ -1,40 +1,31 @@
using System;
+using System.Runtime.Serialization;
namespace Org.BouncyCastle.Crypto
{
- /**
- * this exception is thrown whenever we find something we don't expect in a
- * message.
- */
-#if !PORTABLE
+ /// This exception is thrown whenever we find something we don't expect in a message.
[Serializable]
-#endif
public class InvalidCipherTextException
: CryptoException
{
- /**
- * base constructor.
- */
- public InvalidCipherTextException()
- {
- }
+ public InvalidCipherTextException()
+ : base()
+ {
+ }
- /**
- * create a InvalidCipherTextException with the given message.
- *
- * @param message the message to be carried with the exception.
- */
- public InvalidCipherTextException(
- string message)
+ public InvalidCipherTextException(string message)
: base(message)
- {
- }
+ {
+ }
- public InvalidCipherTextException(
- string message,
- Exception exception)
- : base(message, exception)
- {
- }
- }
+ public InvalidCipherTextException(string message, Exception innerException)
+ : base(message, innerException)
+ {
+ }
+
+ protected InvalidCipherTextException(SerializationInfo info, StreamingContext context)
+ : base(info, context)
+ {
+ }
+ }
}
diff --git a/crypto/src/crypto/MaxBytesExceededException.cs b/crypto/src/crypto/MaxBytesExceededException.cs
index 032901c1d..b83b16fd4 100644
--- a/crypto/src/crypto/MaxBytesExceededException.cs
+++ b/crypto/src/crypto/MaxBytesExceededException.cs
@@ -1,31 +1,32 @@
using System;
+using System.Runtime.Serialization;
namespace Org.BouncyCastle.Crypto
{
- ///
- /// This exception is thrown whenever a cipher requires a change of key, iv
- /// or similar after x amount of bytes enciphered
+ /// This exception is thrown whenever a cipher requires a change of key, IV or similar after x amount of
+ /// bytes enciphered.
///
-#if !PORTABLE
[Serializable]
-#endif
public class MaxBytesExceededException
: CryptoException
{
public MaxBytesExceededException()
+ : base()
{
}
- public MaxBytesExceededException(
- string message)
+ public MaxBytesExceededException(string message)
: base(message)
{
}
- public MaxBytesExceededException(
- string message,
- Exception e)
- : base(message, e)
+ public MaxBytesExceededException(string message, Exception innerException)
+ : base(message, innerException)
+ {
+ }
+
+ protected MaxBytesExceededException(SerializationInfo info, StreamingContext context)
+ : base(info, context)
{
}
}
diff --git a/crypto/src/crypto/OutputLengthException.cs b/crypto/src/crypto/OutputLengthException.cs
index 5f091f2ec..c8b2718f2 100644
--- a/crypto/src/crypto/OutputLengthException.cs
+++ b/crypto/src/crypto/OutputLengthException.cs
@@ -1,28 +1,30 @@
using System;
+using System.Runtime.Serialization;
namespace Org.BouncyCastle.Crypto
{
-#if !PORTABLE
[Serializable]
-#endif
public class OutputLengthException
: DataLengthException
{
- public OutputLengthException()
- {
- }
+ public OutputLengthException()
+ : base()
+ {
+ }
- public OutputLengthException(
- string message)
- : base(message)
- {
- }
+ public OutputLengthException(string message)
+ : base(message)
+ {
+ }
- public OutputLengthException(
- string message,
- Exception exception)
- : base(message, exception)
- {
- }
- }
+ public OutputLengthException(string message, Exception innerException)
+ : base(message, innerException)
+ {
+ }
+
+ protected OutputLengthException(SerializationInfo info, StreamingContext context)
+ : base(info, context)
+ {
+ }
+ }
}
diff --git a/crypto/src/ocsp/OCSPException.cs b/crypto/src/ocsp/OCSPException.cs
index 5ec11fbf7..c575660c5 100644
--- a/crypto/src/ocsp/OCSPException.cs
+++ b/crypto/src/ocsp/OCSPException.cs
@@ -1,27 +1,29 @@
using System;
+using System.Runtime.Serialization;
namespace Org.BouncyCastle.Ocsp
{
-#if !PORTABLE
[Serializable]
-#endif
public class OcspException
: Exception
{
public OcspException()
+ : base()
{
}
- public OcspException(
- string message)
+ public OcspException(string message)
: base(message)
{
}
- public OcspException(
- string message,
- Exception e)
- : base(message, e)
+ public OcspException(string message, Exception innerException)
+ : base(message, innerException)
+ {
+ }
+
+ protected OcspException(SerializationInfo info, StreamingContext context)
+ : base(info, context)
{
}
}
diff --git a/crypto/src/openpgp/PgpDataValidationException.cs b/crypto/src/openpgp/PgpDataValidationException.cs
index cec5c9b68..7718ab26c 100644
--- a/crypto/src/openpgp/PgpDataValidationException.cs
+++ b/crypto/src/openpgp/PgpDataValidationException.cs
@@ -1,18 +1,31 @@
using System;
+using System.Runtime.Serialization;
namespace Org.BouncyCastle.Bcpg.OpenPgp
{
- ///
- /// Thrown if the IV at the start of a data stream indicates the wrong key is being used.
- ///
-#if !PORTABLE
+ /// Thrown if the IV at the start of a data stream indicates the wrong key is being used.
[Serializable]
-#endif
public class PgpDataValidationException
: PgpException
{
- public PgpDataValidationException() : base() {}
- public PgpDataValidationException(string message) : base(message) {}
- public PgpDataValidationException(string message, Exception exception) : base(message, exception) {}
+ public PgpDataValidationException()
+ : base()
+ {
+ }
+
+ public PgpDataValidationException(string message)
+ : base(message)
+ {
+ }
+
+ public PgpDataValidationException(string message, Exception innerException)
+ : base(message, innerException)
+ {
+ }
+
+ protected PgpDataValidationException(SerializationInfo info, StreamingContext context)
+ : base(info, context)
+ {
+ }
}
}
diff --git a/crypto/src/openpgp/PgpException.cs b/crypto/src/openpgp/PgpException.cs
index dc0f3482b..cb5ea3569 100644
--- a/crypto/src/openpgp/PgpException.cs
+++ b/crypto/src/openpgp/PgpException.cs
@@ -1,16 +1,31 @@
using System;
+using System.Runtime.Serialization;
namespace Org.BouncyCastle.Bcpg.OpenPgp
{
- /// Generic exception class for PGP encoding/decoding problems.
-#if !PORTABLE
+ /// Generic exception class for PGP encoding/decoding problems.
[Serializable]
-#endif
public class PgpException
: Exception
{
- public PgpException() : base() {}
- public PgpException(string message) : base(message) {}
- public PgpException(string message, Exception exception) : base(message, exception) {}
+ public PgpException()
+ : base()
+ {
+ }
+
+ public PgpException(string message)
+ : base(message)
+ {
+ }
+
+ public PgpException(string message, Exception innerException)
+ : base(message, innerException)
+ {
+ }
+
+ protected PgpException(SerializationInfo info, StreamingContext context)
+ : base(info, context)
+ {
+ }
}
}
diff --git a/crypto/src/openpgp/PgpKeyValidationException.cs b/crypto/src/openpgp/PgpKeyValidationException.cs
index df6abefe8..655c0a766 100644
--- a/crypto/src/openpgp/PgpKeyValidationException.cs
+++ b/crypto/src/openpgp/PgpKeyValidationException.cs
@@ -1,18 +1,31 @@
using System;
+using System.Runtime.Serialization;
namespace Org.BouncyCastle.Bcpg.OpenPgp
{
- ///
- /// Thrown if the key checksum is invalid.
- ///
-#if !PORTABLE
+ /// Thrown if the key checksum is invalid.
[Serializable]
-#endif
public class PgpKeyValidationException
: PgpException
{
- public PgpKeyValidationException() : base() {}
- public PgpKeyValidationException(string message) : base(message) {}
- public PgpKeyValidationException(string message, Exception exception) : base(message, exception) {}
+ public PgpKeyValidationException()
+ : base()
+ {
+ }
+
+ public PgpKeyValidationException(string message)
+ : base(message)
+ {
+ }
+
+ public PgpKeyValidationException(string message, Exception innerException)
+ : base(message, innerException)
+ {
+ }
+
+ protected PgpKeyValidationException(SerializationInfo info, StreamingContext context)
+ : base(info, context)
+ {
+ }
}
}
diff --git a/crypto/src/openssl/EncryptionException.cs b/crypto/src/openssl/EncryptionException.cs
index c17eb99c4..414f8f68b 100644
--- a/crypto/src/openssl/EncryptionException.cs
+++ b/crypto/src/openssl/EncryptionException.cs
@@ -1,24 +1,30 @@
using System;
using System.IO;
+using System.Runtime.Serialization;
namespace Org.BouncyCastle.Security
{
-#if !PORTABLE
[Serializable]
-#endif
public class EncryptionException
: IOException
{
- public EncryptionException(
- string message)
+ public EncryptionException()
+ : base()
+ {
+ }
+
+ public EncryptionException(string message)
: base(message)
{
}
- public EncryptionException(
- string message,
- Exception exception)
- : base(message, exception)
+ public EncryptionException(string message, Exception innerException)
+ : base(message, innerException)
+ {
+ }
+
+ protected EncryptionException(SerializationInfo info, StreamingContext context)
+ : base(info, context)
{
}
}
diff --git a/crypto/src/openssl/PEMException.cs b/crypto/src/openssl/PEMException.cs
index 3d51d799e..c4314b498 100644
--- a/crypto/src/openssl/PEMException.cs
+++ b/crypto/src/openssl/PEMException.cs
@@ -1,24 +1,30 @@
using System;
using System.IO;
+using System.Runtime.Serialization;
namespace Org.BouncyCastle.OpenSsl
{
-#if !PORTABLE
[Serializable]
-#endif
public class PemException
: IOException
{
- public PemException(
- string message)
+ public PemException()
+ : base()
+ {
+ }
+
+ public PemException(string message)
: base(message)
{
}
- public PemException(
- string message,
- Exception exception)
- : base(message, exception)
+ public PemException(string message, Exception innerException)
+ : base(message, innerException)
+ {
+ }
+
+ protected PemException(SerializationInfo info, StreamingContext context)
+ : base(info, context)
{
}
}
diff --git a/crypto/src/openssl/PasswordException.cs b/crypto/src/openssl/PasswordException.cs
index c920cc7a8..d056bb9b0 100644
--- a/crypto/src/openssl/PasswordException.cs
+++ b/crypto/src/openssl/PasswordException.cs
@@ -1,24 +1,30 @@
using System;
using System.IO;
+using System.Runtime.Serialization;
namespace Org.BouncyCastle.Security
{
-#if !PORTABLE
[Serializable]
-#endif
public class PasswordException
: IOException
{
- public PasswordException(
- string message)
+ public PasswordException()
+ : base()
+ {
+ }
+
+ public PasswordException(string message)
: base(message)
{
}
- public PasswordException(
- string message,
- Exception exception)
- : base(message, exception)
+ public PasswordException(string message, Exception innerException)
+ : base(message, innerException)
+ {
+ }
+
+ protected PasswordException(SerializationInfo info, StreamingContext context)
+ : base(info, context)
{
}
}
diff --git a/crypto/src/pkcs/PkcsException.cs b/crypto/src/pkcs/PkcsException.cs
index 7a69ff736..ba296882c 100644
--- a/crypto/src/pkcs/PkcsException.cs
+++ b/crypto/src/pkcs/PkcsException.cs
@@ -1,21 +1,31 @@
using System;
+using System.Runtime.Serialization;
namespace Org.BouncyCastle.Pkcs
{
- ///
- /// Base exception for PKCS related issues.
- ///
- public class PkcsException
+ /// Base exception for PKCS related issues.
+ [Serializable]
+ public class PkcsException
: Exception
{
- public PkcsException(string message)
- : base(message)
- {
- }
+ public PkcsException()
+ : base()
+ {
+ }
- public PkcsException(string message, Exception underlying)
- : base(message, underlying)
- {
- }
- }
+ public PkcsException(string message)
+ : base(message)
+ {
+ }
+
+ public PkcsException(string message, Exception innerException)
+ : base(message, innerException)
+ {
+ }
+
+ protected PkcsException(SerializationInfo info, StreamingContext context)
+ : base(info, context)
+ {
+ }
+ }
}
diff --git a/crypto/src/pkcs/PkcsIOException.cs b/crypto/src/pkcs/PkcsIOException.cs
index 889b0fcb0..4523ac286 100644
--- a/crypto/src/pkcs/PkcsIOException.cs
+++ b/crypto/src/pkcs/PkcsIOException.cs
@@ -1,19 +1,32 @@
using System;
using System.IO;
+using System.Runtime.Serialization;
namespace Org.BouncyCastle.Pkcs
{
- ///
- /// Base exception for parsing related issues in the PKCS namespace.
- ///
- public class PkcsIOException: IOException
+ /// Base exception for parsing related issues in the PKCS namespace.
+ [Serializable]
+ public class PkcsIOException
+ : IOException
{
- public PkcsIOException(string message) : base(message)
- {
- }
+ public PkcsIOException()
+ : base()
+ {
+ }
- public PkcsIOException(string message, Exception underlying) : base(message, underlying)
- {
- }
- }
+ public PkcsIOException(string message)
+ : base(message)
+ {
+ }
+
+ public PkcsIOException(string message, Exception innerException)
+ : base(message, innerException)
+ {
+ }
+
+ protected PkcsIOException(SerializationInfo info, StreamingContext context)
+ : base(info, context)
+ {
+ }
+ }
}
diff --git a/crypto/src/pkix/PkixCertPathBuilderException.cs b/crypto/src/pkix/PkixCertPathBuilderException.cs
index 46845d287..81c833459 100644
--- a/crypto/src/pkix/PkixCertPathBuilderException.cs
+++ b/crypto/src/pkix/PkixCertPathBuilderException.cs
@@ -1,22 +1,32 @@
using System;
+using System.Runtime.Serialization;
using Org.BouncyCastle.Security;
namespace Org.BouncyCastle.Pkix
{
- ///
- /// Summary description for PkixCertPathBuilderException.
- ///
-#if !PORTABLE
[Serializable]
-#endif
- public class PkixCertPathBuilderException : GeneralSecurityException
+ public class PkixCertPathBuilderException
+ : GeneralSecurityException
{
- public PkixCertPathBuilderException() : base() { }
-
- public PkixCertPathBuilderException(string message) : base(message) { }
+ public PkixCertPathBuilderException()
+ : base()
+ {
+ }
- public PkixCertPathBuilderException(string message, Exception exception) : base(message, exception) { }
-
+ public PkixCertPathBuilderException(string message)
+ : base(message)
+ {
+ }
+
+ public PkixCertPathBuilderException(string message, Exception innerException)
+ : base(message, innerException)
+ {
+ }
+
+ protected PkixCertPathBuilderException(SerializationInfo info, StreamingContext context)
+ : base(info, context)
+ {
+ }
}
}
diff --git a/crypto/src/pkix/PkixCertPathValidatorException.cs b/crypto/src/pkix/PkixCertPathValidatorException.cs
index f2152bcd3..effb60569 100644
--- a/crypto/src/pkix/PkixCertPathValidatorException.cs
+++ b/crypto/src/pkix/PkixCertPathValidatorException.cs
@@ -45,8 +45,8 @@ namespace Org.BouncyCastle.Pkix
{
}
- public PkixCertPathValidatorException(string message, Exception exception)
- : base(message, exception)
+ public PkixCertPathValidatorException(string message, Exception innerException)
+ : base(message, innerException)
{
}
@@ -55,10 +55,10 @@ namespace Org.BouncyCastle.Pkix
/// detail message, cause, certification path, and index.
///
/// the detail message (or null
if none)
- /// the cause (or null
if none)
+ /// the cause (or null
if none)
/// the index of the certificate in the certification path that *
- public PkixCertPathValidatorException(string message, Exception exception, int index)
- : base(message, exception)
+ public PkixCertPathValidatorException(string message, Exception innerException, int index)
+ : base(message, innerException)
{
if (index < -1)
throw new ArgumentException("cannot be < -1", nameof(index));
diff --git a/crypto/src/pkix/PkixNameConstraintValidatorException.cs b/crypto/src/pkix/PkixNameConstraintValidatorException.cs
index d0882ca96..c67123506 100644
--- a/crypto/src/pkix/PkixNameConstraintValidatorException.cs
+++ b/crypto/src/pkix/PkixNameConstraintValidatorException.cs
@@ -1,16 +1,30 @@
using System;
+using System.Runtime.Serialization;
namespace Org.BouncyCastle.Pkix
{
-#if !PORTABLE
[Serializable]
-#endif
public class PkixNameConstraintValidatorException
: Exception
{
- public PkixNameConstraintValidatorException(string msg)
- : base(msg)
- {
- }
+ public PkixNameConstraintValidatorException()
+ : base()
+ {
+ }
+
+ public PkixNameConstraintValidatorException(string message)
+ : base(message)
+ {
+ }
+
+ public PkixNameConstraintValidatorException(string message, Exception innerException)
+ : base(message, innerException)
+ {
+ }
+
+ protected PkixNameConstraintValidatorException(SerializationInfo info, StreamingContext context)
+ : base(info, context)
+ {
+ }
}
}
diff --git a/crypto/src/pqc/crypto/lms/LMSException.cs b/crypto/src/pqc/crypto/lms/LMSException.cs
index 5f8f7b9d9..c9c286b7f 100644
--- a/crypto/src/pqc/crypto/lms/LMSException.cs
+++ b/crypto/src/pqc/crypto/lms/LMSException.cs
@@ -1,22 +1,30 @@
using System;
+using System.Runtime.Serialization;
namespace Org.BouncyCastle.Pqc.Crypto.Lms
{
+ [Serializable]
public class LMSException
: Exception
{
- public LMSException()
- {
- }
+ public LMSException()
+ : base()
+ {
+ }
- public LMSException(string message)
- : base(message)
- {
- }
+ public LMSException(string message)
+ : base(message)
+ {
+ }
- public LMSException(string message, Exception cause)
- : base(message, cause)
- {
- }
- }
-}
\ No newline at end of file
+ public LMSException(string message, Exception innerException)
+ : base(message, innerException)
+ {
+ }
+
+ protected LMSException(SerializationInfo info, StreamingContext context)
+ : base(info, context)
+ {
+ }
+ }
+}
diff --git a/crypto/src/security/GeneralSecurityException.cs b/crypto/src/security/GeneralSecurityException.cs
index 33fd2e543..02b1f6c57 100644
--- a/crypto/src/security/GeneralSecurityException.cs
+++ b/crypto/src/security/GeneralSecurityException.cs
@@ -17,8 +17,8 @@ namespace Org.BouncyCastle.Security
{
}
- public GeneralSecurityException(string message, Exception exception)
- : base(message, exception)
+ public GeneralSecurityException(string message, Exception innerException)
+ : base(message, innerException)
{
}
diff --git a/crypto/src/security/InvalidKeyException.cs b/crypto/src/security/InvalidKeyException.cs
index e9cfa75fd..73a59fbb8 100644
--- a/crypto/src/security/InvalidKeyException.cs
+++ b/crypto/src/security/InvalidKeyException.cs
@@ -1,14 +1,30 @@
using System;
+using System.Runtime.Serialization;
namespace Org.BouncyCastle.Security
{
-#if !PORTABLE
[Serializable]
-#endif
- public class InvalidKeyException : KeyException
+ public class InvalidKeyException
+ : KeyException
{
- public InvalidKeyException() : base() { }
- public InvalidKeyException(string message) : base(message) { }
- public InvalidKeyException(string message, Exception exception) : base(message, exception) { }
+ public InvalidKeyException()
+ : base()
+ {
+ }
+
+ public InvalidKeyException(string message)
+ : base(message)
+ {
+ }
+
+ public InvalidKeyException(string message, Exception innerException)
+ : base(message, innerException)
+ {
+ }
+
+ protected InvalidKeyException(SerializationInfo info, StreamingContext context)
+ : base(info, context)
+ {
+ }
}
}
diff --git a/crypto/src/security/InvalidParameterException.cs b/crypto/src/security/InvalidParameterException.cs
index 27b2ea411..fb27a3688 100644
--- a/crypto/src/security/InvalidParameterException.cs
+++ b/crypto/src/security/InvalidParameterException.cs
@@ -1,14 +1,30 @@
using System;
+using System.Runtime.Serialization;
namespace Org.BouncyCastle.Security
{
-#if !PORTABLE
[Serializable]
-#endif
- public class InvalidParameterException : KeyException
+ public class InvalidParameterException
+ : KeyException
{
- public InvalidParameterException() : base() { }
- public InvalidParameterException(string message) : base(message) { }
- public InvalidParameterException(string message, Exception exception) : base(message, exception) { }
+ public InvalidParameterException()
+ : base()
+ {
+ }
+
+ public InvalidParameterException(string message)
+ : base(message)
+ {
+ }
+
+ public InvalidParameterException(string message, Exception innerException)
+ : base(message, innerException)
+ {
+ }
+
+ protected InvalidParameterException(SerializationInfo info, StreamingContext context)
+ : base(info, context)
+ {
+ }
}
}
diff --git a/crypto/src/security/KeyException.cs b/crypto/src/security/KeyException.cs
index 57ce6862b..1ad1b0c49 100644
--- a/crypto/src/security/KeyException.cs
+++ b/crypto/src/security/KeyException.cs
@@ -1,14 +1,30 @@
using System;
+using System.Runtime.Serialization;
namespace Org.BouncyCastle.Security
{
-#if !PORTABLE
[Serializable]
-#endif
- public class KeyException : GeneralSecurityException
+ public class KeyException
+ : GeneralSecurityException
{
- public KeyException() : base() { }
- public KeyException(string message) : base(message) { }
- public KeyException(string message, Exception exception) : base(message, exception) { }
+ public KeyException()
+ : base()
+ {
+ }
+
+ public KeyException(string message)
+ : base(message)
+ {
+ }
+
+ public KeyException(string message, Exception innerException)
+ : base(message, innerException)
+ {
+ }
+
+ protected KeyException(SerializationInfo info, StreamingContext context)
+ : base(info, context)
+ {
+ }
}
}
diff --git a/crypto/src/security/SecurityUtilityException.cs b/crypto/src/security/SecurityUtilityException.cs
index d3f97c1a3..f10a7fbc5 100644
--- a/crypto/src/security/SecurityUtilityException.cs
+++ b/crypto/src/security/SecurityUtilityException.cs
@@ -1,36 +1,30 @@
using System;
+using System.Runtime.Serialization;
namespace Org.BouncyCastle.Security
{
-#if !PORTABLE
[Serializable]
-#endif
public class SecurityUtilityException
: Exception
{
- /**
- * base constructor.
- */
- public SecurityUtilityException()
- {
- }
+ public SecurityUtilityException()
+ : base()
+ {
+ }
- /**
- * create a SecurityUtilityException with the given message.
- *
- * @param message the message to be carried with the exception.
- */
- public SecurityUtilityException(
- string message)
+ public SecurityUtilityException(string message)
: base(message)
- {
- }
+ {
+ }
- public SecurityUtilityException(
- string message,
- Exception exception)
- : base(message, exception)
- {
- }
- }
+ public SecurityUtilityException(string message, Exception innerException)
+ : base(message, innerException)
+ {
+ }
+
+ protected SecurityUtilityException(SerializationInfo info, StreamingContext context)
+ : base(info, context)
+ {
+ }
+ }
}
diff --git a/crypto/src/security/SignatureException.cs b/crypto/src/security/SignatureException.cs
index deaa23432..4bddc3d51 100644
--- a/crypto/src/security/SignatureException.cs
+++ b/crypto/src/security/SignatureException.cs
@@ -1,14 +1,30 @@
using System;
+using System.Runtime.Serialization;
namespace Org.BouncyCastle.Security
{
-#if !PORTABLE
[Serializable]
-#endif
- public class SignatureException : GeneralSecurityException
+ public class SignatureException
+ : GeneralSecurityException
{
- public SignatureException() : base() { }
- public SignatureException(string message) : base(message) { }
- public SignatureException(string message, Exception exception) : base(message, exception) { }
+ public SignatureException()
+ : base()
+ {
+ }
+
+ public SignatureException(string message)
+ : base(message)
+ {
+ }
+
+ public SignatureException(string message, Exception innerException)
+ : base(message, innerException)
+ {
+ }
+
+ protected SignatureException(SerializationInfo info, StreamingContext context)
+ : base(info, context)
+ {
+ }
}
}
diff --git a/crypto/src/security/cert/CertificateEncodingException.cs b/crypto/src/security/cert/CertificateEncodingException.cs
index 20c965630..5c902dfd1 100644
--- a/crypto/src/security/cert/CertificateEncodingException.cs
+++ b/crypto/src/security/cert/CertificateEncodingException.cs
@@ -1,14 +1,30 @@
using System;
+using System.Runtime.Serialization;
namespace Org.BouncyCastle.Security.Certificates
{
-#if !PORTABLE
[Serializable]
-#endif
- public class CertificateEncodingException : CertificateException
+ public class CertificateEncodingException
+ : CertificateException
{
- public CertificateEncodingException() : base() { }
- public CertificateEncodingException(string msg) : base(msg) { }
- public CertificateEncodingException(string msg, Exception e) : base(msg, e) { }
+ public CertificateEncodingException()
+ : base()
+ {
+ }
+
+ public CertificateEncodingException(string message)
+ : base(message)
+ {
+ }
+
+ public CertificateEncodingException(string message, Exception innerException)
+ : base(message, innerException)
+ {
+ }
+
+ protected CertificateEncodingException(SerializationInfo info, StreamingContext context)
+ : base(info, context)
+ {
+ }
}
}
diff --git a/crypto/src/security/cert/CertificateException.cs b/crypto/src/security/cert/CertificateException.cs
index c8819b710..5214675ab 100644
--- a/crypto/src/security/cert/CertificateException.cs
+++ b/crypto/src/security/cert/CertificateException.cs
@@ -1,14 +1,30 @@
using System;
+using System.Runtime.Serialization;
namespace Org.BouncyCastle.Security.Certificates
{
-#if !PORTABLE
[Serializable]
-#endif
- public class CertificateException : GeneralSecurityException
+ public class CertificateException
+ : GeneralSecurityException
{
- public CertificateException() : base() { }
- public CertificateException(string message) : base(message) { }
- public CertificateException(string message, Exception exception) : base(message, exception) { }
+ public CertificateException()
+ : base()
+ {
+ }
+
+ public CertificateException(string message)
+ : base(message)
+ {
+ }
+
+ public CertificateException(string message, Exception innerException)
+ : base(message, innerException)
+ {
+ }
+
+ protected CertificateException(SerializationInfo info, StreamingContext context)
+ : base(info, context)
+ {
+ }
}
}
diff --git a/crypto/src/security/cert/CertificateExpiredException.cs b/crypto/src/security/cert/CertificateExpiredException.cs
index 1d12ba7e9..25cb054bf 100644
--- a/crypto/src/security/cert/CertificateExpiredException.cs
+++ b/crypto/src/security/cert/CertificateExpiredException.cs
@@ -1,14 +1,30 @@
using System;
+using System.Runtime.Serialization;
namespace Org.BouncyCastle.Security.Certificates
{
-#if !PORTABLE
[Serializable]
-#endif
- public class CertificateExpiredException : CertificateException
+ public class CertificateExpiredException
+ : CertificateException
{
- public CertificateExpiredException() : base() { }
- public CertificateExpiredException(string message) : base(message) { }
- public CertificateExpiredException(string message, Exception exception) : base(message, exception) { }
+ public CertificateExpiredException()
+ : base()
+ {
+ }
+
+ public CertificateExpiredException(string message)
+ : base(message)
+ {
+ }
+
+ public CertificateExpiredException(string message, Exception innerException)
+ : base(message, innerException)
+ {
+ }
+
+ protected CertificateExpiredException(SerializationInfo info, StreamingContext context)
+ : base(info, context)
+ {
+ }
}
}
diff --git a/crypto/src/security/cert/CertificateNotYetValidException.cs b/crypto/src/security/cert/CertificateNotYetValidException.cs
index 8de806673..1ea3d0b97 100644
--- a/crypto/src/security/cert/CertificateNotYetValidException.cs
+++ b/crypto/src/security/cert/CertificateNotYetValidException.cs
@@ -1,14 +1,30 @@
using System;
+using System.Runtime.Serialization;
namespace Org.BouncyCastle.Security.Certificates
{
-#if !PORTABLE
[Serializable]
-#endif
- public class CertificateNotYetValidException : CertificateException
+ public class CertificateNotYetValidException
+ : CertificateException
{
- public CertificateNotYetValidException() : base() { }
- public CertificateNotYetValidException(string message) : base(message) { }
- public CertificateNotYetValidException(string message, Exception exception) : base(message, exception) { }
+ public CertificateNotYetValidException()
+ : base()
+ {
+ }
+
+ public CertificateNotYetValidException(string message)
+ : base(message)
+ {
+ }
+
+ public CertificateNotYetValidException(string message, Exception innerException)
+ : base(message, innerException)
+ {
+ }
+
+ protected CertificateNotYetValidException(SerializationInfo info, StreamingContext context)
+ : base(info, context)
+ {
+ }
}
}
diff --git a/crypto/src/security/cert/CertificateParsingException.cs b/crypto/src/security/cert/CertificateParsingException.cs
index 1e0a3f47a..244f3b614 100644
--- a/crypto/src/security/cert/CertificateParsingException.cs
+++ b/crypto/src/security/cert/CertificateParsingException.cs
@@ -1,14 +1,30 @@
using System;
+using System.Runtime.Serialization;
namespace Org.BouncyCastle.Security.Certificates
{
-#if !PORTABLE
[Serializable]
-#endif
- public class CertificateParsingException : CertificateException
+ public class CertificateParsingException
+ : CertificateException
{
- public CertificateParsingException() : base() { }
- public CertificateParsingException(string message) : base(message) { }
- public CertificateParsingException(string message, Exception exception) : base(message, exception) { }
+ public CertificateParsingException()
+ : base()
+ {
+ }
+
+ public CertificateParsingException(string message)
+ : base(message)
+ {
+ }
+
+ public CertificateParsingException(string message, Exception innerException)
+ : base(message, innerException)
+ {
+ }
+
+ protected CertificateParsingException(SerializationInfo info, StreamingContext context)
+ : base(info, context)
+ {
+ }
}
}
diff --git a/crypto/src/security/cert/CrlException.cs b/crypto/src/security/cert/CrlException.cs
index 4f71bea5f..9475f74de 100644
--- a/crypto/src/security/cert/CrlException.cs
+++ b/crypto/src/security/cert/CrlException.cs
@@ -1,14 +1,30 @@
using System;
+using System.Runtime.Serialization;
namespace Org.BouncyCastle.Security.Certificates
{
-#if !PORTABLE
[Serializable]
-#endif
- public class CrlException : GeneralSecurityException
+ public class CrlException
+ : GeneralSecurityException
{
- public CrlException() : base() { }
- public CrlException(string msg) : base(msg) {}
- public CrlException(string msg, Exception e) : base(msg, e) {}
+ public CrlException()
+ : base()
+ {
+ }
+
+ public CrlException(string message)
+ : base(message)
+ {
+ }
+
+ public CrlException(string message, Exception innerException)
+ : base(message, innerException)
+ {
+ }
+
+ protected CrlException(SerializationInfo info, StreamingContext context)
+ : base(info, context)
+ {
+ }
}
}
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.
///
+ [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
{
- /// Basic exception class for crypto services to pass back a cause.
- public class TlsCryptoException
+ /// Basic exception class for crypto services to pass back a cause.
+ [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)
+ {
+ }
+ }
}
diff --git a/crypto/src/tsp/TSPException.cs b/crypto/src/tsp/TSPException.cs
index 0213490d9..2fe7fdc90 100644
--- a/crypto/src/tsp/TSPException.cs
+++ b/crypto/src/tsp/TSPException.cs
@@ -1,27 +1,29 @@
using System;
+using System.Runtime.Serialization;
namespace Org.BouncyCastle.Tsp
{
-#if !PORTABLE
[Serializable]
-#endif
public class TspException
: Exception
{
public TspException()
+ : base()
{
}
- public TspException(
- string message)
+ public TspException(string message)
: base(message)
{
}
- public TspException(
- string message,
- Exception e)
- : base(message, e)
+ public TspException(string message, Exception innerException)
+ : base(message, innerException)
+ {
+ }
+
+ protected TspException(SerializationInfo info, StreamingContext context)
+ : base(info, context)
{
}
}
diff --git a/crypto/src/tsp/TSPValidationException.cs b/crypto/src/tsp/TSPValidationException.cs
index 066a398e4..eb5181f2e 100644
--- a/crypto/src/tsp/TSPValidationException.cs
+++ b/crypto/src/tsp/TSPValidationException.cs
@@ -1,4 +1,5 @@
using System;
+using System.Runtime.Serialization;
namespace Org.BouncyCastle.Tsp
{
@@ -8,34 +9,30 @@ namespace Org.BouncyCastle.Tsp
* If a failure code is associated with the exception it can be retrieved using
* the getFailureCode() method.
*/
-#if !PORTABLE
[Serializable]
-#endif
public class TspValidationException
: TspException
{
private int failureCode;
- public TspValidationException(
- string message)
+ public TspValidationException(string message)
: base(message)
{
this.failureCode = -1;
}
- public TspValidationException(
- string message,
- int failureCode)
+ public TspValidationException(string message, int failureCode)
: base(message)
{
this.failureCode = failureCode;
}
- /**
- * Return the failure code associated with this exception - if one is set.
- *
- * @return the failure code if set, -1 otherwise.
- */
+ protected TspValidationException(SerializationInfo info, StreamingContext context)
+ : base(info, context)
+ {
+ }
+
+ /// The failure code associated with this exception, if one is set.
public int FailureCode
{
get { return failureCode; }
diff --git a/crypto/src/util/MemoableResetException.cs b/crypto/src/util/MemoableResetException.cs
index 99554f6c2..8a4deb142 100644
--- a/crypto/src/util/MemoableResetException.cs
+++ b/crypto/src/util/MemoableResetException.cs
@@ -1,27 +1,38 @@
using System;
+using System.Runtime.Serialization;
namespace Org.BouncyCastle.Utilities
{
- /**
+ /**
* Exception to be thrown on a failure to reset an object implementing Memoable.
*
* The exception extends InvalidCastException to enable users to have a single handling case,
* only introducing specific handling of this one if required.
*
*/
- public class MemoableResetException
+ [Serializable]
+ public class MemoableResetException
: InvalidCastException
{
- /**
- * Basic Constructor.
- *
- * @param msg message to be associated with this exception.
- */
- public MemoableResetException(string msg)
- : base(msg)
- {
- }
- }
+ public MemoableResetException()
+ : base()
+ {
+ }
+ public MemoableResetException(string message)
+ : base(message)
+ {
+ }
+
+ public MemoableResetException(string message, Exception innerException)
+ : base(message, innerException)
+ {
+ }
+
+ protected MemoableResetException(SerializationInfo info, StreamingContext context)
+ : base(info, context)
+ {
+ }
+ }
}
diff --git a/crypto/src/util/io/StreamOverflowException.cs b/crypto/src/util/io/StreamOverflowException.cs
index 7e100e7b5..a36919780 100644
--- a/crypto/src/util/io/StreamOverflowException.cs
+++ b/crypto/src/util/io/StreamOverflowException.cs
@@ -1,11 +1,10 @@
using System;
using System.IO;
+using System.Runtime.Serialization;
namespace Org.BouncyCastle.Utilities.IO
{
-#if !PORTABLE
[Serializable]
-#endif
public class StreamOverflowException
: IOException
{
@@ -14,16 +13,18 @@ namespace Org.BouncyCastle.Utilities.IO
{
}
- public StreamOverflowException(
- string message)
+ public StreamOverflowException(string message)
: base(message)
{
}
- public StreamOverflowException(
- string message,
- Exception exception)
- : base(message, exception)
+ public StreamOverflowException(string message, Exception innerException)
+ : base(message, innerException)
+ {
+ }
+
+ protected StreamOverflowException(SerializationInfo info, StreamingContext context)
+ : base(info, context)
{
}
}
diff --git a/crypto/src/util/io/pem/PemGenerationException.cs b/crypto/src/util/io/pem/PemGenerationException.cs
index a49dda0e7..b7f30672e 100644
--- a/crypto/src/util/io/pem/PemGenerationException.cs
+++ b/crypto/src/util/io/pem/PemGenerationException.cs
@@ -1,10 +1,9 @@
using System;
+using System.Runtime.Serialization;
namespace Org.BouncyCastle.Utilities.IO.Pem
{
-#if !PORTABLE
[Serializable]
-#endif
public class PemGenerationException
: Exception
{
@@ -13,16 +12,18 @@ namespace Org.BouncyCastle.Utilities.IO.Pem
{
}
- public PemGenerationException(
- string message)
+ public PemGenerationException(string message)
: base(message)
{
}
- public PemGenerationException(
- string message,
- Exception exception)
- : base(message, exception)
+ public PemGenerationException(string message, Exception innerException)
+ : base(message, innerException)
+ {
+ }
+
+ protected PemGenerationException(SerializationInfo info, StreamingContext context)
+ : base(info, context)
{
}
}
diff --git a/crypto/src/x509/store/NoSuchStoreException.cs b/crypto/src/x509/store/NoSuchStoreException.cs
index bf6bdf76c..3acac536f 100644
--- a/crypto/src/x509/store/NoSuchStoreException.cs
+++ b/crypto/src/x509/store/NoSuchStoreException.cs
@@ -1,27 +1,29 @@
using System;
+using System.Runtime.Serialization;
namespace Org.BouncyCastle.X509.Store
{
-#if !PORTABLE
[Serializable]
-#endif
public class NoSuchStoreException
: X509StoreException
{
public NoSuchStoreException()
+ : base()
{
}
- public NoSuchStoreException(
- string message)
+ public NoSuchStoreException(string message)
: base(message)
{
}
- public NoSuchStoreException(
- string message,
- Exception e)
- : base(message, e)
+ public NoSuchStoreException(string message, Exception innerException)
+ : base(message, innerException)
+ {
+ }
+
+ protected NoSuchStoreException(SerializationInfo info, StreamingContext context)
+ : base(info, context)
{
}
}
diff --git a/crypto/src/x509/store/X509StoreException.cs b/crypto/src/x509/store/X509StoreException.cs
index f697c116a..0ad32c2ef 100644
--- a/crypto/src/x509/store/X509StoreException.cs
+++ b/crypto/src/x509/store/X509StoreException.cs
@@ -1,27 +1,29 @@
using System;
+using System.Runtime.Serialization;
namespace Org.BouncyCastle.X509.Store
{
-#if !PORTABLE
[Serializable]
-#endif
public class X509StoreException
: Exception
{
public X509StoreException()
+ : base()
{
}
- public X509StoreException(
- string message)
+ public X509StoreException(string message)
: base(message)
{
}
- public X509StoreException(
- string message,
- Exception e)
- : base(message, e)
+ public X509StoreException(string message, Exception innerException)
+ : base(message, innerException)
+ {
+ }
+
+ protected X509StoreException(SerializationInfo info, StreamingContext context)
+ : base(info, context)
{
}
}
diff --git a/crypto/test/src/util/test/SimpleTest.cs b/crypto/test/src/util/test/SimpleTest.cs
index fc88be103..1695164e5 100644
--- a/crypto/test/src/util/test/SimpleTest.cs
+++ b/crypto/test/src/util/test/SimpleTest.cs
@@ -108,7 +108,7 @@ namespace Org.BouncyCastle.Utilities.Test
}
catch (TestFailedException e)
{
- return e.GetResult();
+ return e.Result;
}
catch (Exception e)
{
diff --git a/crypto/test/src/util/test/TestFailedException.cs b/crypto/test/src/util/test/TestFailedException.cs
index 215e1fd20..2ea66087d 100644
--- a/crypto/test/src/util/test/TestFailedException.cs
+++ b/crypto/test/src/util/test/TestFailedException.cs
@@ -2,23 +2,20 @@ using System;
namespace Org.BouncyCastle.Utilities.Test
{
-#if !PORTABLE
- [Serializable]
-#endif
public class TestFailedException
: Exception
{
- private ITestResult _result;
+ private readonly ITestResult m_result;
- public TestFailedException(
- ITestResult result)
+ public TestFailedException(ITestResult result)
+ : base()
{
- _result = result;
+ m_result = result;
}
- public ITestResult GetResult()
+ public ITestResult Result
{
- return _result;
+ get { return m_result; }
}
}
}
--
cgit 1.4.1