1 17 18 package org.apache.geronimo.util.asn1; 19 20 import java.io.IOException ; 21 22 25 public class DERUnknownTag 26 extends DERObject 27 { 28 int tag; 29 byte[] data; 30 31 35 public DERUnknownTag( 36 int tag, 37 byte[] data) 38 { 39 this.tag = tag; 40 this.data = data; 41 } 42 43 public int getTag() 44 { 45 return tag; 46 } 47 48 public byte[] getData() 49 { 50 return data; 51 } 52 53 void encode( 54 DEROutputStream out) 55 throws IOException 56 { 57 out.writeEncoded(tag, data); 58 } 59 60 public boolean equals( 61 Object o) 62 { 63 if ((o == null) || !(o instanceof DERUnknownTag)) 64 { 65 return false; 66 } 67 68 DERUnknownTag other = (DERUnknownTag)o; 69 70 if (tag != other.tag) 71 { 72 return false; 73 } 74 75 if (data.length != other.data.length) 76 { 77 return false; 78 } 79 80 for (int i = 0; i < data.length; i++) 81 { 82 if(data[i] != other.data[i]) 83 { 84 return false; 85 } 86 } 87 88 return true; 89 } 90 91 public int hashCode() 92 { 93 byte[] b = this.getData(); 94 int value = 0; 95 96 for (int i = 0; i != b.length; i++) 97 { 98 value ^= (b[i] & 0xff) << (i % 4); 99 } 100 101 return value ^ this.getTag(); 102 } 103 } 104 | Popular Tags |