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.ASN1Sequence; 22 import org.apache.geronimo.util.asn1.ASN1TaggedObject; 23 import org.apache.geronimo.util.asn1.DERObject; 24 import org.apache.geronimo.util.asn1.DERSequence; 25 26 public class GeneralNames 27 extends ASN1Encodable 28 { 29 ASN1Sequence seq; 30 31 public static GeneralNames getInstance( 32 Object obj) 33 { 34 if (obj == null || obj instanceof GeneralNames) 35 { 36 return (GeneralNames)obj; 37 } 38 39 if (obj instanceof ASN1Sequence) 40 { 41 return new GeneralNames((ASN1Sequence)obj); 42 } 43 44 throw new IllegalArgumentException ("illegal object in getInstance: " + obj.getClass().getName()); 45 } 46 47 public static GeneralNames getInstance( 48 ASN1TaggedObject obj, 49 boolean explicit) 50 { 51 return getInstance(ASN1Sequence.getInstance(obj, explicit)); 52 } 53 54 59 public GeneralNames( 60 GeneralName name) 61 { 62 this.seq = new DERSequence(name); 63 } 64 65 public GeneralNames( 66 ASN1Sequence seq) 67 { 68 this.seq = seq; 69 } 70 71 public GeneralName[] getNames() 72 { 73 GeneralName[] names = new GeneralName[seq.size()]; 74 75 for (int i = 0; i != seq.size(); i++) 76 { 77 names[i] = GeneralName.getInstance(seq.getObjectAt(i)); 78 } 79 80 return names; 81 } 82 83 89 public DERObject toASN1Object() 90 { 91 return seq; 92 } 93 } 94 | Popular Tags |