1 17 18 package org.apache.geronimo.util.asn1.x509; 19 20 import org.apache.geronimo.util.asn1.ASN1OctetString; 21 import org.apache.geronimo.util.asn1.DERBoolean; 22 23 26 public class X509Extension 27 { 28 boolean critical; 29 ASN1OctetString value; 30 31 public X509Extension( 32 DERBoolean critical, 33 ASN1OctetString value) 34 { 35 this.critical = critical.isTrue(); 36 this.value = value; 37 } 38 39 public X509Extension( 40 boolean critical, 41 ASN1OctetString value) 42 { 43 this.critical = critical; 44 this.value = value; 45 } 46 47 public boolean isCritical() 48 { 49 return critical; 50 } 51 52 public ASN1OctetString getValue() 53 { 54 return value; 55 } 56 57 public int hashCode() 58 { 59 if (this.isCritical()) 60 { 61 return this.getValue().hashCode(); 62 } 63 64 65 return ~this.getValue().hashCode(); 66 } 67 68 public boolean equals( 69 Object o) 70 { 71 if (o == null || !(o instanceof X509Extension)) 72 { 73 return false; 74 } 75 76 X509Extension other = (X509Extension)o; 77 78 return other.getValue().equals(this.getValue()) 79 && (other.isCritical() == this.isCritical()); 80 } 81 } 82 | Popular Tags |