summary refs log tree commit diff
path: root/crypto/src/x509/X509CrlEntry.cs
diff options
context:
space:
mode:
Diffstat (limited to 'crypto/src/x509/X509CrlEntry.cs')
-rw-r--r--crypto/src/x509/X509CrlEntry.cs33
1 files changed, 32 insertions, 1 deletions
diff --git a/crypto/src/x509/X509CrlEntry.cs b/crypto/src/x509/X509CrlEntry.cs
index caca29470..9e3608c18 100644
--- a/crypto/src/x509/X509CrlEntry.cs
+++ b/crypto/src/x509/X509CrlEntry.cs
@@ -1,6 +1,5 @@
 using System;
 using System.Collections;
-using System.IO;
 using System.Text;
 
 using Org.BouncyCastle.Asn1;
@@ -27,6 +26,9 @@ namespace Org.BouncyCastle.X509
 		private X509Name	previousCertificateIssuer;
 		private X509Name	certificateIssuer;
 
+        private volatile bool hashValueSet;
+        private volatile int hashValue;
+
 		public X509CrlEntry(
 			CrlEntry c)
 		{
@@ -132,6 +134,35 @@ namespace Org.BouncyCastle.X509
 			get { return c.Extensions != null; }
 		}
 
+        public override bool Equals(object other)
+        {
+            if (this == other)
+                return true;
+
+            X509CrlEntry that = other as X509CrlEntry;
+            if (null == that)
+                return false;
+
+            if (this.hashValueSet && that.hashValueSet)
+            {
+                if (this.hashValue != that.hashValue)
+                    return false;
+            }
+
+            return this.c.Equals(that.c);
+        }
+
+        public override int GetHashCode()
+        {
+            if (!hashValueSet)
+            {
+                hashValue = this.c.GetHashCode();
+                hashValueSet = true;
+            }
+
+            return hashValue;
+        }
+
 		public override string ToString()
 		{
 			StringBuilder buf = new StringBuilder();