1 17 18 package org.apache.geronimo.util.asn1.x509; 19 20 import java.util.Enumeration ; 21 22 import org.apache.geronimo.util.asn1.ASN1Encodable; 23 import org.apache.geronimo.util.asn1.ASN1EncodableVector; 24 import org.apache.geronimo.util.asn1.ASN1Sequence; 25 import org.apache.geronimo.util.asn1.ASN1TaggedObject; 26 import org.apache.geronimo.util.asn1.DERObject; 27 import org.apache.geronimo.util.asn1.DERSequence; 28 import org.apache.geronimo.util.asn1.DERTaggedObject; 29 30 public class NameConstraints 31 extends ASN1Encodable 32 { 33 ASN1Sequence permitted, excluded; 34 35 public NameConstraints( 36 ASN1Sequence seq) 37 { 38 Enumeration e = seq.getObjects(); 39 while (e.hasMoreElements()) 40 { 41 ASN1TaggedObject o = (ASN1TaggedObject)e.nextElement(); 42 switch (o.getTagNo()) 43 { 44 case 0: 45 permitted = ASN1Sequence.getInstance(o, false); 46 break; 47 case 1: 48 excluded = ASN1Sequence.getInstance(o, false); 49 break; 50 } 51 } 52 } 53 54 public ASN1Sequence getPermittedSubtrees() 55 { 56 return permitted; 57 } 58 59 public ASN1Sequence getExcludedSubtrees() 60 { 61 return excluded; 62 } 63 64 69 public DERObject toASN1Object() 70 { 71 ASN1EncodableVector v = new ASN1EncodableVector(); 72 73 if (permitted != null) 74 { 75 v.add(new DERTaggedObject(false, 0, permitted)); 76 } 77 78 if (excluded != null) 79 { 80 v.add(new DERTaggedObject(false, 1, excluded)); 81 } 82 83 return new DERSequence(v); 84 } 85 } 86 | Popular Tags |