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