1    package org.bouncycastle.asn1;
2    
3    import java.io.*;
4    
5    /**
6     * We insert one of these when we find a tag we don't recognise.
7     */
8    public class DERUnknownTag
9        extends DERObject
10   {
11       int         tag;
12       byte[]      data;
13   
14       /**
15        * @param tag the tag value.
16        * @param data the octets making up the time.
17        */
18       public DERUnknownTag(
19           int     tag,
20           byte[]  data)
21       {
22           this.tag = tag;
23           this.data = data;
24       }
25   
26       public int getTag()
27       {
28           return tag;
29       }
30   
31       public byte[] getData()
32       {
33           return data;
34       }
35   
36       void encode(
37           DEROutputStream  out)
38           throws IOException
39       {
40           out.writeEncoded(tag, data);
41       }
42       
43           public boolean equals(
44                   Object o)
45           {
46           if ((o == null) || !(o instanceof DERUnknownTag))
47           {
48               return false;
49           }
50           
51           DERUnknownTag other = (DERUnknownTag)o;
52           
53           if(tag != other.tag)
54           {
55                           return false;
56                   }
57                   
58                   if(data.length != other.data.length)
59                   {
60                           return false;
61                   }
62                   
63                   for(int i = 0; i < data.length; i++) 
64                   {
65                           if(data[i] != other.data[i])
66                           {
67                                   return false;
68                           }
69                   }
70                   
71                   return true;
72           }
73   }
74