1 17 18 19 package org.apache.geronimo.util.asn1.x509; 20 21 import org.apache.geronimo.util.asn1.ASN1Encodable; 22 import org.apache.geronimo.util.asn1.ASN1EncodableVector; 23 import org.apache.geronimo.util.asn1.ASN1Sequence; 24 import org.apache.geronimo.util.asn1.ASN1TaggedObject; 25 import org.apache.geronimo.util.asn1.DERBitString; 26 import org.apache.geronimo.util.asn1.DERObject; 27 import org.apache.geronimo.util.asn1.DERSequence; 28 29 42 public class CertificateList 43 extends ASN1Encodable 44 { 45 TBSCertList tbsCertList; 46 AlgorithmIdentifier sigAlgId; 47 DERBitString sig; 48 49 public static CertificateList getInstance( 50 ASN1TaggedObject obj, 51 boolean explicit) 52 { 53 return getInstance(ASN1Sequence.getInstance(obj, explicit)); 54 } 55 56 public static CertificateList getInstance( 57 Object obj) 58 { 59 if (obj instanceof CertificateList) 60 { 61 return (CertificateList)obj; 62 } 63 else if (obj instanceof ASN1Sequence) 64 { 65 return new CertificateList((ASN1Sequence)obj); 66 } 67 68 throw new IllegalArgumentException ("unknown object in factory"); 69 } 70 71 public CertificateList( 72 ASN1Sequence seq) 73 { 74 if (seq.size() == 3) 75 { 76 tbsCertList = TBSCertList.getInstance(seq.getObjectAt(0)); 77 sigAlgId = AlgorithmIdentifier.getInstance(seq.getObjectAt(1)); 78 sig = (DERBitString)seq.getObjectAt(2); 79 } 80 else 81 { 82 throw new IllegalArgumentException ("sequence wrong size for CertificateList"); 83 } 84 } 85 86 public TBSCertList getTBSCertList() 87 { 88 return tbsCertList; 89 } 90 91 public TBSCertList.CRLEntry[] getRevokedCertificates() 92 { 93 return tbsCertList.getRevokedCertificates(); 94 } 95 96 public AlgorithmIdentifier getSignatureAlgorithm() 97 { 98 return sigAlgId; 99 } 100 101 public DERBitString getSignature() 102 { 103 return sig; 104 } 105 106 public int getVersion() 107 { 108 return tbsCertList.getVersion(); 109 } 110 111 public X509Name getIssuer() 112 { 113 return tbsCertList.getIssuer(); 114 } 115 116 public Time getThisUpdate() 117 { 118 return tbsCertList.getThisUpdate(); 119 } 120 121 public Time getNextUpdate() 122 { 123 return tbsCertList.getNextUpdate(); 124 } 125 126 public DERObject toASN1Object() 127 { 128 ASN1EncodableVector v = new ASN1EncodableVector(); 129 130 v.add(tbsCertList); 131 v.add(sigAlgId); 132 v.add(sig); 133 134 return new DERSequence(v); 135 } 136 } 137 | Popular Tags |