1 19 20 package com.maverick.crypto.asn1; 21 22 import java.io.ByteArrayOutputStream ; 23 import java.io.IOException ; 24 import java.util.Enumeration ; 25 26 public class DERConstructedSet 27 extends ASN1Set 28 { 29 public DERConstructedSet() 30 { 31 } 32 33 36 public DERConstructedSet( 37 DEREncodable obj) 38 { 39 this.addObject(obj); 40 } 41 42 45 public DERConstructedSet( 46 DEREncodableVector v) 47 { 48 for (int i = 0; i != v.size(); i++) 49 { 50 this.addObject(v.get(i)); 51 } 52 } 53 54 public void addObject( 55 DEREncodable obj) 56 { 57 super.addObject(obj); 58 } 59 60 public int getSize() 61 { 62 return size(); 63 } 64 65 73 void encode( 74 DEROutputStream out) 75 throws IOException 76 { 77 ByteArrayOutputStream bOut = new ByteArrayOutputStream (); 78 DEROutputStream dOut = new DEROutputStream(bOut); 79 Enumeration e = this.getObjects(); 80 81 while (e.hasMoreElements()) 82 { 83 Object obj = e.nextElement(); 84 85 dOut.writeObject(obj); 86 } 87 88 dOut.close(); 89 90 byte[] bytes = bOut.toByteArray(); 91 92 out.writeEncoded(SET | CONSTRUCTED, bytes); 93 } 94 } 95 | Popular Tags |