1 package org.bouncycastle.asn1.x509;
2
3 import org.bouncycastle.asn1.*;
4
5
8 public class X509Extension
9 {
10 boolean critical;
11 DEROctetString value;
12
13 public X509Extension(
14 DERBoolean critical,
15 DEROctetString value)
16 {
17 this.critical = critical.isTrue();
18 this.value = value;
19 }
20
21 public X509Extension(
22 boolean critical,
23 DEROctetString value)
24 {
25 this.critical = critical;
26 this.value = value;
27 }
28
29 public boolean isCritical()
30 {
31 return critical;
32 }
33
34 public DEROctetString getValue()
35 {
36 return value;
37 }
38
39 public int hashCode()
40 {
41 if (this.isCritical())
42 {
43 return this.getValue().hashCode();
44 }
45
46
47 return ~this.getValue().hashCode();
48 }
49
50 public boolean equals(
51 Object o)
52 {
53 if (o == null || !(o instanceof X509Extension))
54 {
55 return false;
56 }
57
58 X509Extension other = (X509Extension)o;
59
60 return other.getValue().equals(this.getValue())
61 && (other.isCritical() == this.isCritical());
62 }
63 }
64