1 20 package com.novosec.pkix.asn1.cmp; 21 22 import java.util.Enumeration ; 23 import java.util.Vector ; 24 25 import org.bouncycastle.asn1.ASN1EncodableVector; 26 import org.bouncycastle.asn1.ASN1Sequence; 27 import org.bouncycastle.asn1.ASN1TaggedObject; 28 import org.bouncycastle.asn1.DEREncodable; 29 import org.bouncycastle.asn1.DERObject; 30 import org.bouncycastle.asn1.DERSequence; 31 32 40 public class RevReqContent implements DEREncodable 41 { 42 Vector revDetails = new Vector (); 43 44 public static RevReqContent getInstance( ASN1TaggedObject obj, boolean explicit ) 45 { 46 return getInstance(ASN1Sequence.getInstance(obj, explicit)); 47 } 48 49 public static RevReqContent getInstance( Object obj ) 50 { 51 if (obj instanceof RevReqContent) 52 { 53 return (RevReqContent)obj; 54 } 55 else if (obj instanceof ASN1Sequence) 56 { 57 return new RevReqContent((ASN1Sequence)obj); 58 } 59 60 throw new IllegalArgumentException ("unknown object in factory"); 61 } 62 63 public RevReqContent( ASN1Sequence seq ) 64 { 65 Enumeration e = seq.getObjects(); 66 67 while (e.hasMoreElements()) 68 revDetails.addElement(RevDetails.getInstance(e.nextElement())); 69 } 70 71 public RevReqContent( RevDetails p ) 72 { 73 revDetails.addElement(p); 74 } 75 76 public void addRevDetails( RevDetails p ) 77 { 78 revDetails.addElement(p); 79 } 80 81 public RevDetails getRevDetails(int nr) 82 { 83 if (revDetails.size() > nr) 84 return (RevDetails)revDetails.elementAt(nr); 85 86 return null; 87 } 88 89 public DERObject getDERObject() 90 { 91 ASN1EncodableVector v = new ASN1EncodableVector(); 92 93 for (int i=0;i<revDetails.size();i++) 94 v.add((RevDetails)revDetails.elementAt(i)); 95 96 return new DERSequence(v); 97 } 98 99 public String toString() 100 { 101 String s = "RevReqContent: ("; 102 103 for (int i=0;i<revDetails.size();i++) 104 s += revDetails.elementAt(i) + ", "; 105 106 s += ")"; 107 108 return s; 109 } 110 } 111 | Popular Tags |