summaryrefslogtreecommitdiffstats
path: root/base/util/src/netscape/security/x509
diff options
context:
space:
mode:
Diffstat (limited to 'base/util/src/netscape/security/x509')
-rw-r--r--base/util/src/netscape/security/x509/AlgIdDSA.java42
-rwxr-xr-xbase/util/src/netscape/security/x509/CRLExtensions.java26
-rw-r--r--base/util/src/netscape/security/x509/CertificateExtensions.java26
-rw-r--r--base/util/src/netscape/security/x509/Extensions.java26
4 files changed, 120 insertions, 0 deletions
diff --git a/base/util/src/netscape/security/x509/AlgIdDSA.java b/base/util/src/netscape/security/x509/AlgIdDSA.java
index a34c5f59f..1f00b0355 100644
--- a/base/util/src/netscape/security/x509/AlgIdDSA.java
+++ b/base/util/src/netscape/security/x509/AlgIdDSA.java
@@ -174,4 +174,46 @@ public final class AlgIdDSA extends AlgorithmId implements DSAParams {
"\n g:\n" + (new BigInt(g)).toString() +
"\n";
}
+
+ @Override
+ public int hashCode() {
+ final int prime = 31;
+ int result = 1;
+ result = prime * result + ((g == null) ? 0 : g.hashCode());
+ result = prime * result + ((p == null) ? 0 : p.hashCode());
+ result = prime * result + ((q == null) ? 0 : q.hashCode());
+ return result;
+ }
+
+ @Override
+ public boolean equals(Object other) {
+ if (other == null) {
+ return false;
+ }
+ if (other instanceof AlgIdDSA) {
+ AlgIdDSA rhs = (AlgIdDSA) other;
+ if (this == rhs) {
+ return true;
+ }
+ if (!(bigIntEquals(this.p, rhs.p) && bigIntEquals(this.q, rhs.q) && bigIntEquals(this.g, rhs.g))) {
+ return false;
+ }
+ return super.equals(rhs);
+ }
+ return false;
+ }
+
+ public boolean bigIntEquals(BigInteger x, BigInteger y) {
+ if (x == null) {
+ if (y != null) {
+ return false;
+ }
+ } else {
+ if (!x.equals(y)) {
+ return false;
+ }
+ }
+ return true;
+ }
+
}
diff --git a/base/util/src/netscape/security/x509/CRLExtensions.java b/base/util/src/netscape/security/x509/CRLExtensions.java
index 60a6532ba..9c844cd3d 100755
--- a/base/util/src/netscape/security/x509/CRLExtensions.java
+++ b/base/util/src/netscape/security/x509/CRLExtensions.java
@@ -226,4 +226,30 @@ public class CRLExtensions extends Vector<Extension> {
public Enumeration<Extension> getElements() {
return (map.elements());
}
+
+ @Override
+ public int hashCode() {
+ final int prime = 31;
+ int result = super.hashCode();
+ result = prime * result + ((map == null) ? 0 : map.hashCode());
+ return result;
+ }
+
+ @Override
+ public boolean equals(Object obj) {
+ if (this == obj)
+ return true;
+ if (!super.equals(obj))
+ return false;
+ if (getClass() != obj.getClass())
+ return false;
+ CRLExtensions other = (CRLExtensions) obj;
+ if (map == null) {
+ if (other.map != null)
+ return false;
+ } else if (!map.equals(other.map))
+ return false;
+ return true;
+ }
+
}
diff --git a/base/util/src/netscape/security/x509/CertificateExtensions.java b/base/util/src/netscape/security/x509/CertificateExtensions.java
index a8ce5ebee..93be196ab 100644
--- a/base/util/src/netscape/security/x509/CertificateExtensions.java
+++ b/base/util/src/netscape/security/x509/CertificateExtensions.java
@@ -273,4 +273,30 @@ public class CertificateExtensions extends Vector<Extension>
public String getName() {
return (NAME);
}
+
+ @Override
+ public int hashCode() {
+ final int prime = 31;
+ int result = super.hashCode();
+ result = prime * result + ((map == null) ? 0 : map.hashCode());
+ return result;
+ }
+
+ @Override
+ public boolean equals(Object obj) {
+ if (this == obj)
+ return true;
+ if (!super.equals(obj))
+ return false;
+ if (getClass() != obj.getClass())
+ return false;
+ CertificateExtensions other = (CertificateExtensions) obj;
+ if (map == null) {
+ if (other.map != null)
+ return false;
+ } else if (!map.equals(other.map))
+ return false;
+ return true;
+ }
+
}
diff --git a/base/util/src/netscape/security/x509/Extensions.java b/base/util/src/netscape/security/x509/Extensions.java
index 3feac9599..109f795e9 100644
--- a/base/util/src/netscape/security/x509/Extensions.java
+++ b/base/util/src/netscape/security/x509/Extensions.java
@@ -223,4 +223,30 @@ public class Extensions extends Vector<Extension>
public String getName() {
return (NAME);
}
+
+ @Override
+ public int hashCode() {
+ final int prime = 31;
+ int result = super.hashCode();
+ result = prime * result + ((map == null) ? 0 : map.hashCode());
+ return result;
+ }
+
+ @Override
+ public boolean equals(Object obj) {
+ if (this == obj)
+ return true;
+ if (!super.equals(obj))
+ return false;
+ if (getClass() != obj.getClass())
+ return false;
+ Extensions other = (Extensions) obj;
+ if (map == null) {
+ if (other.map != null)
+ return false;
+ } else if (!map.equals(other.map))
+ return false;
+ return true;
+ }
+
}