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 35 public class AccessDescription 36 extends ASN1Encodable 37 { 38 DERObjectIdentifier accessMethod = null; 39 GeneralName accessLocation = null; 40 41 public static AccessDescription getInstance( 42 Object obj) 43 { 44 if (obj instanceof AccessDescription) 45 { 46 return (AccessDescription)obj; 47 } 48 else if (obj instanceof ASN1Sequence) 49 { 50 return new AccessDescription((ASN1Sequence)obj); 51 } 52 53 throw new IllegalArgumentException ("unknown object in factory"); 54 } 55 56 public AccessDescription( 57 ASN1Sequence seq) 58 { 59 if (seq.size() != 2) 60 { 61 throw new IllegalArgumentException ("wrong number of elements in inner sequence"); 62 } 63 64 accessMethod = (DERObjectIdentifier)seq.getObjectAt(0); 65 accessLocation = GeneralName.getInstance(seq.getObjectAt(1)); 66 } 67 68 71 public AccessDescription( 72 DERObjectIdentifier oid, 73 GeneralName location) 74 { 75 accessMethod = oid; 76 accessLocation = location; 77 } 78 79 83 public DERObjectIdentifier getAccessMethod() 84 { 85 return accessMethod; 86 } 87 88 92 public GeneralName getAccessLocation() 93 { 94 return accessLocation; 95 } 96 97 public DERObject toASN1Object() 98 { 99 ASN1EncodableVector accessDescription = new ASN1EncodableVector(); 100 101 accessDescription.add(accessMethod); 102 accessDescription.add(accessLocation); 103 104 return new DERSequence(accessDescription); 105 } 106 107 public String toString() 108 { 109 return ("AccessDescription: Oid(" + this.accessMethod.getId() + ")"); 110 } 111 } 112 | Popular Tags |