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 DERSequence 27 extends ASN1Sequence 28 { 29 32 public DERSequence() 33 { 34 } 35 36 39 public DERSequence( 40 DEREncodable obj) 41 { 42 this.addObject(obj); 43 } 44 45 48 public DERSequence( 49 DEREncodableVector v) 50 { 51 for (int i = 0; i != v.size(); i++) 52 { 53 this.addObject(v.get(i)); 54 } 55 } 56 57 65 void encode( 66 DEROutputStream out) 67 throws IOException 68 { 69 ByteArrayOutputStream bOut = new ByteArrayOutputStream (); 70 DEROutputStream dOut = new DEROutputStream(bOut); 71 Enumeration e = this.getObjects(); 72 73 while (e.hasMoreElements()) 74 { 75 Object obj = e.nextElement(); 76 77 dOut.writeObject(obj); 78 } 79 80 dOut.close(); 81 82 byte[] bytes = bOut.toByteArray(); 83 84 out.writeEncoded(SEQUENCE | CONSTRUCTED, bytes); 85 } 86 } 87 | Popular Tags |