summary refs log tree commit diff
path: root/crypto/src/asn1
diff options
context:
space:
mode:
Diffstat (limited to 'crypto/src/asn1')
-rw-r--r--crypto/src/asn1/cmp/PKIFreeText.cs10
-rw-r--r--crypto/src/asn1/x509/CertificateList.cs23
-rw-r--r--crypto/src/asn1/x509/X509CertificateStructure.cs11
3 files changed, 17 insertions, 27 deletions
diff --git a/crypto/src/asn1/cmp/PKIFreeText.cs b/crypto/src/asn1/cmp/PKIFreeText.cs
index f3a4b8a81..f4d7e0967 100644
--- a/crypto/src/asn1/cmp/PKIFreeText.cs
+++ b/crypto/src/asn1/cmp/PKIFreeText.cs
@@ -7,13 +7,11 @@ namespace Org.BouncyCastle.Asn1.Cmp
 	{
 		public static PkiFreeText GetInstance(object obj)
 		{
+			if (obj == null)
+				return null;
 			if (obj is PkiFreeText pkiFreeText)
 				return pkiFreeText;
-
-			if (obj != null)
-                return new PkiFreeText(Asn1Sequence.GetInstance(obj));
-
-            return null;
+            return new PkiFreeText(Asn1Sequence.GetInstance(obj));
 		}
 
         public static PkiFreeText GetInstance(Asn1TaggedObject taggedObject, bool declaredExplicit)
@@ -21,7 +19,7 @@ namespace Org.BouncyCastle.Asn1.Cmp
             return GetInstance(Asn1Sequence.GetInstance(taggedObject, declaredExplicit));
         }
 
-        internal Asn1Sequence m_strings;
+        private readonly Asn1Sequence m_strings;
 
         internal PkiFreeText(Asn1Sequence seq)
 		{
diff --git a/crypto/src/asn1/x509/CertificateList.cs b/crypto/src/asn1/x509/CertificateList.cs
index 3d5d2e557..5d73cf411 100644
--- a/crypto/src/asn1/x509/CertificateList.cs
+++ b/crypto/src/asn1/x509/CertificateList.cs
@@ -23,26 +23,21 @@ namespace Org.BouncyCastle.Asn1.X509
         private readonly AlgorithmIdentifier sigAlgID;
         private readonly DerBitString sig;
 
-		public static CertificateList GetInstance(
-            Asn1TaggedObject	obj,
-            bool				explicitly)
+        public static CertificateList GetInstance(Asn1TaggedObject obj, bool explicitly)
         {
             return GetInstance(Asn1Sequence.GetInstance(obj, explicitly));
         }
 
-		public static CertificateList GetInstance(
-            object obj)
+        public static CertificateList GetInstance(object obj)
         {
-            if (obj is CertificateList)
-                return (CertificateList) obj;
-
-			if (obj != null)
-				return new CertificateList(Asn1Sequence.GetInstance(obj));
-
-			return null;
-		}
+            if (obj == null)
+                return null;
+            if (obj is CertificateList certificateList)
+                return certificateList;
+            return new CertificateList(Asn1Sequence.GetInstance(obj));
+        }
 
-		private CertificateList(
+        private CertificateList(
             Asn1Sequence seq)
         {
 			if (seq.Count != 3)
diff --git a/crypto/src/asn1/x509/X509CertificateStructure.cs b/crypto/src/asn1/x509/X509CertificateStructure.cs
index 6e7c85de6..5394b2be3 100644
--- a/crypto/src/asn1/x509/X509CertificateStructure.cs
+++ b/crypto/src/asn1/x509/X509CertificateStructure.cs
@@ -21,20 +21,17 @@ namespace Org.BouncyCastle.Asn1.X509
         private readonly AlgorithmIdentifier		sigAlgID;
         private readonly DerBitString				sig;
 
-        public static X509CertificateStructure GetInstance(
-            Asn1TaggedObject	obj,
-            bool				explicitly)
+        public static X509CertificateStructure GetInstance(Asn1TaggedObject obj, bool explicitly)
         {
             return GetInstance(Asn1Sequence.GetInstance(obj, explicitly));
         }
 
-        public static X509CertificateStructure GetInstance(
-            object obj)
+        public static X509CertificateStructure GetInstance(object obj)
         {
-            if (obj is X509CertificateStructure)
-                return (X509CertificateStructure)obj;
             if (obj == null)
                 return null;
+            if (obj is X509CertificateStructure x509CertificateStructure)
+                return x509CertificateStructure;
             return new X509CertificateStructure(Asn1Sequence.GetInstance(obj));
         }