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 * This creates an empty tagged object of tagNo (ie. zero length).
17 * @param tagNo the tag number for this object.
19 public BERTaggedObject(
26 * @param tagNo the tag number for this object.
27 * @param obj the tagged object.
29 public BERTaggedObject(
37 * @param explicit true if an explicitly tagged object.
38 * @param tagNo the tag number for this object.
39 * @param obj the tagged object.
41 public BERTaggedObject(
46 super(explicit, tagNo, obj);
53 if (out instanceof BEROutputStream)
55 out.write(CONSTRUCTED | TAGGED | tagNo);
60 ByteArrayOutputStream bOut = new ByteArrayOutputStream();
61 BEROutputStream dOut = new BEROutputStream(bOut);
65 if (obj instanceof BERConstructedOctetString)
67 Vector octs = ((BERConstructedOctetString)obj).getDEROctets();
69 for (int i = 0; i != octs.size(); i++)
71 dOut.writeObject(octs.elementAt(i));
76 dOut.writeObject(obj); // hmmm...
81 dOut.writeObject(obj);
86 out.write(bOut.toByteArray());