1 package org.bouncycastle.asn1;
2
3 import java.io.*;
4 import java.util.*;
5
6 public class DERSequence
7 extends ASN1Sequence
8 {
9
12 public DERSequence()
13 {
14 }
15
16
19 public DERSequence(
20 DEREncodable obj)
21 {
22 this.addObject(obj);
23 }
24
25
28 public DERSequence(
29 DEREncodableVector v)
30 {
31 for (int i = 0; i != v.size(); i++)
32 {
33 this.addObject(v.get(i));
34 }
35 }
36
37
45 void encode(
46 DEROutputStream out)
47 throws IOException
48 {
49 ByteArrayOutputStream bOut = new ByteArrayOutputStream();
50 DEROutputStream dOut = new DEROutputStream(bOut);
51 Enumeration e = this.getObjects();
52
53 while (e.hasMoreElements())
54 {
55 Object obj = e.nextElement();
56
57 dOut.writeObject(obj);
58 }
59
60 dOut.close();
61
62 byte[] bytes = bOut.toByteArray();
63
64 out.writeEncoded(SEQUENCE | CONSTRUCTED, bytes);
65 }
66 }
67