1 17 18 package org.apache.geronimo.util.asn1; 19 20 import java.io.ByteArrayOutputStream ; 21 import java.io.IOException ; 22 23 public abstract class ASN1Encodable 24 implements DEREncodable 25 { 26 public byte[] getEncoded() 27 throws IOException 28 { 29 ByteArrayOutputStream bOut = new ByteArrayOutputStream (); 30 ASN1OutputStream aOut = new ASN1OutputStream(bOut); 31 32 aOut.writeObject(this); 33 34 return bOut.toByteArray(); 35 } 36 37 public int hashCode() 38 { 39 return this.toASN1Object().hashCode(); 40 } 41 42 public boolean equals( 43 Object o) 44 { 45 if ((o == null) || !(o instanceof ASN1Encodable)) 46 { 47 return false; 48 } 49 50 ASN1Encodable other = (ASN1Encodable)o; 51 52 return this.toASN1Object().equals(other.toASN1Object()); 53 } 54 55 public DERObject getDERObject() 56 { 57 return this.toASN1Object(); 58 } 59 60 public abstract DERObject toASN1Object(); 61 } 62 | Popular Tags |