1 package org.bouncycastle.asn1;
6 public class DERConstructedSet
9 public DERConstructedSet()
14 * @param obj - a single object that makes up the set.
16 public DERConstructedSet(
23 * @param v - a vector of objects making up the set.
25 public DERConstructedSet(
28 for (int i = 0; i != v.size(); i++)
30 this.addObject(v.get(i));
34 public void addObject(
46 * A note on the implementation:
48 * As DER requires the constructed, definite-length model to
49 * be used for structured types, this varies slightly from the
50 * ASN.1 descriptions given. Rather than just outputing SET,
51 * we also have to specify CONSTRUCTED, and the objects length.
57 ByteArrayOutputStream bOut = new ByteArrayOutputStream();
58 DEROutputStream dOut = new DEROutputStream(bOut);
59 Enumeration e = this.getObjects();
61 while (e.hasMoreElements())
63 Object obj = e.nextElement();
65 dOut.writeObject(obj);
70 byte[] bytes = bOut.toByteArray();
72 out.writeEncoded(SET | CONSTRUCTED, bytes);