1 package org.bouncycastle.asn1;
2
3 import java.io.*;
4 import java.util.*;
5
6
9 public class DERSet
10 extends ASN1Set
11 {
12
15 public DERSet()
16 {
17 }
18
19
22 public DERSet(
23 DEREncodable obj)
24 {
25 this.addObject(obj);
26 }
27
28
31 public DERSet(
32 DEREncodableVector v)
33 {
34 for (int i = 0; i != v.size(); i++)
35 {
36 this.addObject(v.get(i));
37 }
38 }
39
40
48 void encode(
49 DEROutputStream out)
50 throws IOException
51 {
52 ByteArrayOutputStream bOut = new ByteArrayOutputStream();
53 DEROutputStream dOut = new DEROutputStream(bOut);
54 Enumeration e = this.getObjects();
55
56 while (e.hasMoreElements())
57 {
58 Object obj = e.nextElement();
59
60 dOut.writeObject(obj);
61 }
62
63 dOut.close();
64
65 byte[] bytes = bOut.toByteArray();
66
67 out.writeEncoded(SET | CONSTRUCTED, bytes);
68 }
69 }
70