summary refs log tree commit diff
diff options
context:
space:
mode:
authorPeter Dettman <peter.dettman@bouncycastle.org>2023-01-27 12:51:18 +0700
committerPeter Dettman <peter.dettman@bouncycastle.org>2023-01-27 12:51:18 +0700
commit0c21bca32d3ac397ada9be1f0482540f7247f7cf (patch)
tree6053bb9606d6e8c2047a2cdd766c658dad19ec11
parentMisc. cleanup after bc-fips-csharp updates (diff)
downloadBouncyCastle.NET-ed25519-0c21bca32d3ac397ada9be1f0482540f7247f7cf.tar.xz
MIsc. cleanup
-rw-r--r--crypto/src/asn1/x509/KeyUsage.cs8
-rw-r--r--crypto/src/asn1/x509/X509Extensions.cs4
-rw-r--r--crypto/src/util/Platform.cs7
-rw-r--r--crypto/src/util/io/LimitedInputStream.cs3
4 files changed, 13 insertions, 9 deletions
diff --git a/crypto/src/asn1/x509/KeyUsage.cs b/crypto/src/asn1/x509/KeyUsage.cs
index b31b54341..dd69cc63b 100644
--- a/crypto/src/asn1/x509/KeyUsage.cs
+++ b/crypto/src/asn1/x509/KeyUsage.cs
@@ -32,10 +32,10 @@ namespace Org.BouncyCastle.Asn1.X509
 
 		public static new KeyUsage GetInstance(object obj)
 		{
-			if (obj is KeyUsage)
-				return (KeyUsage)obj;
-            if (obj is X509Extension)
-				return GetInstance(X509Extension.ConvertValueToObject((X509Extension)obj));
+			if (obj is KeyUsage keyUsage)
+				return keyUsage;
+            if (obj is X509Extension x509Extension)
+				return GetInstance(X509Extension.ConvertValueToObject(x509Extension));
             if (obj == null)
                 return null;
 			return new KeyUsage(DerBitString.GetInstance(obj));
diff --git a/crypto/src/asn1/x509/X509Extensions.cs b/crypto/src/asn1/x509/X509Extensions.cs
index a399058c2..aa5205800 100644
--- a/crypto/src/asn1/x509/X509Extensions.cs
+++ b/crypto/src/asn1/x509/X509Extensions.cs
@@ -175,12 +175,12 @@ namespace Org.BouncyCastle.Asn1.X509
 
         public static X509Extension GetExtension(X509Extensions extensions, DerObjectIdentifier oid)
         {
-            return null == extensions ? null : extensions.GetExtension(oid);
+            return extensions?.GetExtension(oid);
         }
 
         public static Asn1Encodable GetExtensionParsedValue(X509Extensions extensions, DerObjectIdentifier oid)
         {
-            return null == extensions ? null : extensions.GetExtensionParsedValue(oid);
+            return extensions?.GetExtensionParsedValue(oid);
         }
 
 		public static X509Extensions GetInstance(Asn1TaggedObject taggedObject, bool declaredExplicit)
diff --git a/crypto/src/util/Platform.cs b/crypto/src/util/Platform.cs
index a78153b8c..e43714181 100644
--- a/crypto/src/util/Platform.cs
+++ b/crypto/src/util/Platform.cs
@@ -63,7 +63,12 @@ namespace Org.BouncyCastle.Utilities
 
         internal static string GetTypeName(object obj)
         {
-            return obj.GetType().FullName;
+            return GetTypeName(obj.GetType());
+        }
+
+        internal static string GetTypeName(Type t)
+        {
+            return t.FullName;
         }
     }
 }
diff --git a/crypto/src/util/io/LimitedInputStream.cs b/crypto/src/util/io/LimitedInputStream.cs
index d6616eff5..4c6aac631 100644
--- a/crypto/src/util/io/LimitedInputStream.cs
+++ b/crypto/src/util/io/LimitedInputStream.cs
@@ -1,5 +1,4 @@
-using Org.BouncyCastle.Utilities.Zlib;
-using System;
+using System;
 using System.IO;
 
 namespace Org.BouncyCastle.Utilities.IO