1 17 18 19 package org.apache.geronimo.util.asn1.x509; 20 21 import java.util.Enumeration ; 22 import java.util.Vector ; 23 24 import org.apache.geronimo.util.asn1.ASN1Encodable; 25 import org.apache.geronimo.util.asn1.ASN1EncodableVector; 26 import org.apache.geronimo.util.asn1.ASN1Sequence; 27 import org.apache.geronimo.util.asn1.DERInteger; 28 import org.apache.geronimo.util.asn1.DERObject; 29 import org.apache.geronimo.util.asn1.DERSequence; 30 31 46 public class NoticeReference 47 extends ASN1Encodable 48 { 49 DisplayText organization; 50 ASN1Sequence noticeNumbers; 51 52 58 public NoticeReference (String orgName, Vector numbers) 59 { 60 organization = new DisplayText(orgName); 61 62 Object o = numbers.elementAt(0); 63 64 ASN1EncodableVector av = new ASN1EncodableVector(); 65 if (o instanceof Integer ) { 66 Enumeration it = numbers.elements(); 67 68 while (it.hasMoreElements()) { 69 Integer nm = (Integer ) it.nextElement(); 70 DERInteger di = new DERInteger(nm.intValue()); 71 av.add (di); 72 } 73 } 74 75 noticeNumbers = new DERSequence(av); 76 } 77 78 84 public NoticeReference (String orgName, ASN1Sequence numbers) 85 { 86 organization = new DisplayText (orgName); 87 noticeNumbers = numbers; 88 } 89 90 97 public NoticeReference (int displayTextType, 98 String orgName, ASN1Sequence numbers) 99 { 100 organization = new DisplayText(displayTextType, 101 orgName); 102 noticeNumbers = numbers; 103 } 104 105 114 public NoticeReference (ASN1Sequence as) 115 { 116 organization = DisplayText.getInstance(as.getObjectAt(0)); 117 noticeNumbers = (ASN1Sequence) as.getObjectAt(1); 118 } 119 120 public static NoticeReference getInstance (Object as) 121 { 122 if (as instanceof NoticeReference) 123 { 124 return (NoticeReference)as; 125 } 126 else if (as instanceof ASN1Sequence) 127 { 128 return new NoticeReference((ASN1Sequence)as); 129 } 130 131 throw new IllegalArgumentException ("unknown object in getInstance."); 132 } 133 134 139 public DERObject toASN1Object() 140 { 141 ASN1EncodableVector av = new ASN1EncodableVector(); 142 av.add (organization); 143 av.add (noticeNumbers); 144 return new DERSequence (av); 145 } 146 } 147 | Popular Tags |