1 package org.bouncycastle.asn1;
6 * ASN.1 TaggedObject - in ASN.1 nottation this is any object proceeded by
7 * a [n] where n is some number - these are assume to follow the construction
8 * rules (as with sequences).
10 public abstract class ASN1TaggedObject
14 boolean empty = false;
15 boolean explicit = true;
16 DEREncodable obj = null;
19 * @param tagNo the tag number for this object.
20 * @param obj the tagged object.
22 public ASN1TaggedObject(
32 * @param explicit true if the object is explicitly tagged.
33 * @param tagNo the tag number for this object.
34 * @param obj the tagged object.
36 public ASN1TaggedObject(
41 this.explicit = explicit;
46 public boolean equals(
49 if (o == null || !(o instanceof ASN1TaggedObject))
54 ASN1TaggedObject other = (ASN1TaggedObject)o;
56 if(tagNo != other.tagNo || empty != other.empty || explicit != other.explicit)
70 if(!(obj.equals(other.obj)))
85 * return whether or not the object may be explicitly tagged.
87 * Note: if the object has been read from an input stream, the only
88 * time you can be sure if isExplicit is returning the true state of
89 * affairs is if it returns false. An implicitly tagged object may appear
90 * to be explicitly tagged, so you need to understand the context under
91 * which the reading was done as well, see getObject below.
93 public boolean isExplicit()
98 public boolean isEmpty()
104 * return whatever was following the tag.
106 * Note: tagged objects are generally context dependent if you're
107 * trying to extract a tagged object you should be going via the
108 * appropriate getInstance method.
110 public DERObject getObject()
114 return obj.getDERObject();
120 abstract void encode(DEROutputStream out)