1 package org.bouncycastle.asn1;
6 public class DERSequence
10 * create an empty sequence
17 * create a sequence containing one object
26 * create a sequence containing a vector of objects.
31 for (int i = 0; i != v.size(); i++)
33 this.addObject(v.get(i));
38 * A note on the implementation:
40 * As DER requires the constructed, definite-length model to
41 * be used for structured types, this varies slightly from the
42 * ASN.1 descriptions given. Rather than just outputing SEQUENCE,
43 * we also have to specify CONSTRUCTED, and the objects length.
49 ByteArrayOutputStream bOut = new ByteArrayOutputStream();
50 DEROutputStream dOut = new DEROutputStream(bOut);
51 Enumeration e = this.getObjects();
53 while (e.hasMoreElements())
55 Object obj = e.nextElement();
57 dOut.writeObject(obj);
62 byte[] bytes = bOut.toByteArray();
64 out.writeEncoded(SEQUENCE | CONSTRUCTED, bytes);