1 17 18 package org.apache.geronimo.util.asn1.x509; 19 20 import org.apache.geronimo.util.asn1.ASN1Encodable; 21 import org.apache.geronimo.util.asn1.ASN1EncodableVector; 22 import org.apache.geronimo.util.asn1.ASN1Sequence; 23 import org.apache.geronimo.util.asn1.DERObject; 24 import org.apache.geronimo.util.asn1.DERObjectIdentifier; 25 import org.apache.geronimo.util.asn1.DERSequence; 26 27 43 public class AuthorityInformationAccess 44 extends ASN1Encodable 45 { 46 private AccessDescription[] descriptions; 47 48 public static AuthorityInformationAccess getInstance( 49 Object obj) 50 { 51 if (obj instanceof AuthorityInformationAccess) 52 { 53 return (AuthorityInformationAccess)obj; 54 } 55 else if (obj instanceof ASN1Sequence) 56 { 57 return new AuthorityInformationAccess((ASN1Sequence)obj); 58 } 59 60 throw new IllegalArgumentException ("unknown object in factory"); 61 } 62 63 public AuthorityInformationAccess( 64 ASN1Sequence seq) 65 { 66 descriptions = new AccessDescription[seq.size()]; 67 68 for (int i = 0; i != seq.size(); i++) 69 { 70 descriptions[i] = AccessDescription.getInstance(seq.getObjectAt(i)); 71 } 72 } 73 74 77 public AuthorityInformationAccess( 78 DERObjectIdentifier oid, 79 GeneralName location) 80 { 81 descriptions = new AccessDescription[1]; 82 83 descriptions[0] = new AccessDescription(oid, location); 84 } 85 86 87 91 public AccessDescription[] getAccessDescriptions() 92 { 93 return descriptions; 94 } 95 96 public DERObject toASN1Object() 97 { 98 ASN1EncodableVector vec = new ASN1EncodableVector(); 99 100 for (int i = 0; i != descriptions.length; i++) 101 { 102 vec.add(descriptions[i]); 103 } 104 105 return new DERSequence(vec); 106 } 107 108 public String toString() 109 { 110 return ("AuthorityInformationAccess: Oid(" + this.descriptions[0].getAccessMethod().getId() + ")"); 111 } 112 } 113 | Popular Tags |