summary refs log tree commit diff
diff options
context:
space:
mode:
authorPeter Dettman <peter.dettman@bouncycastle.org>2024-05-10 19:01:19 +0700
committerPeter Dettman <peter.dettman@bouncycastle.org>2024-05-10 19:01:19 +0700
commit095edd12f340bbcd35b09ead847fe2ee0ac39b41 (patch)
tree462cd6aee98aef3a19c15554395f2b1de6364913
parentadded CVE-IDs (diff)
downloadBouncyCastle.NET-ed25519-095edd12f340bbcd35b09ead847fe2ee0ac39b41.tar.xz
Improve Asn1OctetString.Asn1Equals
-rw-r--r--crypto/src/asn1/Asn1OctetString.cs11
1 files changed, 3 insertions, 8 deletions
diff --git a/crypto/src/asn1/Asn1OctetString.cs b/crypto/src/asn1/Asn1OctetString.cs
index 9104c9ad3..d68d093e2 100644
--- a/crypto/src/asn1/Asn1OctetString.cs
+++ b/crypto/src/asn1/Asn1OctetString.cs
@@ -129,15 +129,10 @@ namespace Org.BouncyCastle.Asn1
 			return Arrays.GetHashCode(GetOctets());
         }
 
-		protected override bool Asn1Equals(
-			Asn1Object asn1Object)
+		protected override bool Asn1Equals(Asn1Object asn1Object)
 		{
-			DerOctetString other = asn1Object as DerOctetString;
-
-			if (other == null)
-				return false;
-
-			return Arrays.AreEqual(GetOctets(), other.GetOctets());
+            return asn1Object is Asn1OctetString that
+                && Arrays.AreEqual(this.GetOctets(), that.GetOctets());
 		}
 
 		public override string ToString()