1 package org.bouncycastle.asn1;
7 * BER TaggedObject - in ASN.1 nottation this is any object proceeded by
8 * a [n] where n is some number - these are assume to follow the construction
9 * rules (as with sequences).
11 public class BERTaggedObject
12 extends DERTaggedObject
15 * @param tagNo the tag number for this object.
16 * @param obj the tagged object.
18 public BERTaggedObject(
26 * @param explicit true if an explicitly tagged object.
27 * @param tagNo the tag number for this object.
28 * @param obj the tagged object.
30 public BERTaggedObject(
35 super(explicit, tagNo, obj);
39 * create an implicitly tagged object that contains a zero
42 public BERTaggedObject(
45 super(false, tagNo, new BERConstructedSequence());
52 if (out instanceof ASN1OutputStream || out instanceof BEROutputStream)
54 out.write(CONSTRUCTED | TAGGED | tagNo);
61 if (obj instanceof BERConstructedOctetString)
63 Enumeration e = ((BERConstructedOctetString)obj).getObjects();
65 while (e.hasMoreElements())
67 out.writeObject(e.nextElement());
70 else if (obj instanceof ASN1Sequence)
72 Enumeration e = ((ASN1Sequence)obj).getObjects();
74 while (e.hasMoreElements())
76 out.writeObject(e.nextElement());
79 else if (obj instanceof ASN1Set)
81 Enumeration e = ((ASN1Set)obj).getObjects();
83 while (e.hasMoreElements())
85 out.writeObject(e.nextElement());
90 throw new RuntimeException("not implemented: " + obj.getClass().getName());