1 package org.bouncycastle.asn1;
7 * A DER encoded set object
20 * @param obj - a single object that makes up the set.
29 * @param v - a vector of objects making up the set.
34 for (int i = 0; i != v.size(); i++)
36 this.addObject(v.get(i));
41 * A note on the implementation:
43 * As DER requires the constructed, definite-length model to
44 * be used for structured types, this varies slightly from the
45 * ASN.1 descriptions given. Rather than just outputing SET,
46 * we also have to specify CONSTRUCTED, and the objects length.
52 ByteArrayOutputStream bOut = new ByteArrayOutputStream();
53 DEROutputStream dOut = new DEROutputStream(bOut);
54 Enumeration e = this.getObjects();
56 while (e.hasMoreElements())
58 Object obj = e.nextElement();
60 dOut.writeObject(obj);
65 byte[] bytes = bOut.toByteArray();
67 out.writeEncoded(SET | CONSTRUCTED, bytes);