summary refs log tree commit diff
diff options
context:
space:
mode:
authorPeter Dettman <peter.dettman@bouncycastle.org>2022-11-09 12:55:04 +0700
committerPeter Dettman <peter.dettman@bouncycastle.org>2022-11-09 12:55:04 +0700
commit278643286dc1f5a4e5ac155bbfe8b122e3dee784 (patch)
tree189d7a0bb4f448d9c754b0e11fb8b2b8b176cd6f
parentIStreamGenerator changes (diff)
downloadBouncyCastle.NET-ed25519-278643286dc1f5a4e5ac155bbfe8b122e3dee784.tar.xz
Cleanup
-rw-r--r--crypto/src/asn1/esf/CrlIdentifier.cs21
-rw-r--r--crypto/src/pqc/crypto/utils/PqcPublicKeyFactory.cs4
2 files changed, 10 insertions, 15 deletions
diff --git a/crypto/src/asn1/esf/CrlIdentifier.cs b/crypto/src/asn1/esf/CrlIdentifier.cs
index 4a2480b4b..54e930acc 100644
--- a/crypto/src/asn1/esf/CrlIdentifier.cs
+++ b/crypto/src/asn1/esf/CrlIdentifier.cs
@@ -1,5 +1,5 @@
 using System;
-using System.Reflection;
+
 using Org.BouncyCastle.Asn1.X509;
 using Org.BouncyCastle.Math;
 using Org.BouncyCastle.Utilities;
@@ -75,21 +75,16 @@ namespace Org.BouncyCastle.Asn1.Esf
 
         public CrlIdentifier(X509Name crlIssuer, Asn1UtcTime crlIssuedTime, BigInteger crlNumber)
         {
-            if (crlIssuer == null)
-                throw new ArgumentNullException(nameof(crlIssuer));
-            if (crlIssuedTime == null)
-                throw new ArgumentNullException(nameof(crlIssuedTime));
-
-            // Validate crlIssuedTime is in the appropriate year range
-            crlIssuedTime.ToDateTime(2049);
-
-            this.crlIssuer = crlIssuer;
-            this.crlIssuedTime = crlIssuedTime;
+            this.crlIssuer = crlIssuer ?? throw new ArgumentNullException(nameof(crlIssuer));
+            this.crlIssuedTime = crlIssuedTime ?? throw new ArgumentNullException(nameof(crlIssuedTime));
 
             if (null != crlNumber)
             {
                 this.crlNumber = new DerInteger(crlNumber);
             }
+
+            // Validate crlIssuedTime is in the appropriate year range
+            this.crlIssuedTime.ToDateTime(2049);
         }
 
         public X509Name CrlIssuer
@@ -104,12 +99,12 @@ namespace Org.BouncyCastle.Asn1.Esf
 
 		public BigInteger CrlNumber
 		{
-			get { return crlNumber == null ? null : crlNumber.Value; }
+			get { return crlNumber?.Value; }
 		}
 
 		public override Asn1Object ToAsn1Object()
 		{
-			Asn1EncodableVector v = new Asn1EncodableVector(crlIssuer.ToAsn1Object(), crlIssuedTime);
+			var v = new Asn1EncodableVector(crlIssuer.ToAsn1Object(), crlIssuedTime);
             v.AddOptional(crlNumber);
 			return new DerSequence(v);
 		}
diff --git a/crypto/src/pqc/crypto/utils/PqcPublicKeyFactory.cs b/crypto/src/pqc/crypto/utils/PqcPublicKeyFactory.cs
index c8ca11de6..7f863820e 100644
--- a/crypto/src/pqc/crypto/utils/PqcPublicKeyFactory.cs
+++ b/crypto/src/pqc/crypto/utils/PqcPublicKeyFactory.cs
@@ -283,7 +283,7 @@ namespace Org.BouncyCastle.Pqc.Crypto.Utilities
                         return new DilithiumPublicKeyParameters(dilithiumParams, encKey);
                     }
                 }
-                catch (Exception e)
+                catch (Exception)
                 {
                     // raw encoding
                     return new DilithiumPublicKeyParameters(dilithiumParams, keyInfo.PublicKeyData.GetOctets());
@@ -344,7 +344,7 @@ namespace Org.BouncyCastle.Pqc.Crypto.Utilities
                         return new FalconPublicKeyParameters(falconParams, Arrays.CopyOfRange(keyEnc, 1, keyEnc.Length));
                     }
                 }
-                catch (Exception e)
+                catch (Exception)
                 {
                     // raw encoding
                     byte[] keyEnc = keyInfo.PublicKeyData.GetOctets();