From c0bf600ca228f47b15472d24edd9f0b2d931f18b Mon Sep 17 00:00:00 2001 From: Peter Dettman Date: Fri, 12 Nov 2021 01:37:42 +0700 Subject: Add new Equals method --- crypto/src/asn1/Asn1Object.cs | 5 +++++ crypto/src/asn1/Asn1ObjectDescriptor.cs | 2 +- crypto/src/asn1/Asn1Sequence.cs | 2 +- crypto/src/asn1/Asn1Set.cs | 2 +- 4 files changed, 8 insertions(+), 3 deletions(-) (limited to 'crypto/src/asn1') diff --git a/crypto/src/asn1/Asn1Object.cs b/crypto/src/asn1/Asn1Object.cs index e6498060d..9945a7fae 100644 --- a/crypto/src/asn1/Asn1Object.cs +++ b/crypto/src/asn1/Asn1Object.cs @@ -20,6 +20,11 @@ namespace Org.BouncyCastle.Asn1 asn1Out.FlushInternal(); } + public bool Equals(Asn1Object other) + { + return this == other || Asn1Equals(other); + } + /// Create a base ASN.1 object from a byte array. /// The byte array to parse. /// The base ASN.1 object represented by the byte array. diff --git a/crypto/src/asn1/Asn1ObjectDescriptor.cs b/crypto/src/asn1/Asn1ObjectDescriptor.cs index 4d25da77b..e306d827e 100644 --- a/crypto/src/asn1/Asn1ObjectDescriptor.cs +++ b/crypto/src/asn1/Asn1ObjectDescriptor.cs @@ -103,7 +103,7 @@ namespace Org.BouncyCastle.Asn1 { Asn1ObjectDescriptor that = asn1Object as Asn1ObjectDescriptor; return null != that - && this.m_baseGraphicString.CallAsn1Equals(that.m_baseGraphicString); + && this.m_baseGraphicString.Equals(that.m_baseGraphicString); } internal static Asn1ObjectDescriptor CreatePrimitive(byte[] contents) diff --git a/crypto/src/asn1/Asn1Sequence.cs b/crypto/src/asn1/Asn1Sequence.cs index 9ab41ffd3..bd1b46b49 100644 --- a/crypto/src/asn1/Asn1Sequence.cs +++ b/crypto/src/asn1/Asn1Sequence.cs @@ -228,7 +228,7 @@ namespace Org.BouncyCastle.Asn1 Asn1Object o1 = this.elements[i].ToAsn1Object(); Asn1Object o2 = that.elements[i].ToAsn1Object(); - if (o1 != o2 && !o1.CallAsn1Equals(o2)) + if (!o1.Equals(o2)) return false; } diff --git a/crypto/src/asn1/Asn1Set.cs b/crypto/src/asn1/Asn1Set.cs index 6193e8178..45febabaf 100644 --- a/crypto/src/asn1/Asn1Set.cs +++ b/crypto/src/asn1/Asn1Set.cs @@ -259,7 +259,7 @@ namespace Org.BouncyCastle.Asn1 Asn1Object o1 = this.elements[i].ToAsn1Object(); Asn1Object o2 = that.elements[i].ToAsn1Object(); - if (o1 != o2 && !o1.CallAsn1Equals(o2)) + if (!o1.Equals(o2)) return false; } -- cgit 1.4.1