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.DEREncodable; 24 import org.apache.geronimo.util.asn1.DERObject; 25 import org.apache.geronimo.util.asn1.DERIA5String; 26 import org.apache.geronimo.util.asn1.DERObjectIdentifier; 27 import org.apache.geronimo.util.asn1.DERSequence; 28 29 39 public class PolicyQualifierInfo 40 extends ASN1Encodable 41 { 42 DERObjectIdentifier policyQualifierId; 43 DEREncodable qualifier; 44 45 51 public PolicyQualifierInfo (DERObjectIdentifier policyQualifierId, 52 DEREncodable qualifier) 53 { 54 this.policyQualifierId = policyQualifierId; 55 this.qualifier = qualifier; 56 } 57 58 65 public PolicyQualifierInfo (String cps) 66 { 67 policyQualifierId = PolicyQualifierId.id_qt_cps; 68 qualifier = new DERIA5String (cps); 69 } 70 71 77 public PolicyQualifierInfo (ASN1Sequence as) 78 { 79 policyQualifierId = (DERObjectIdentifier) as.getObjectAt(0); 80 qualifier = as.getObjectAt(1); 81 } 82 83 public static PolicyQualifierInfo getInstance (Object as) 84 { 85 if (as instanceof PolicyQualifierInfo) 86 { 87 return (PolicyQualifierInfo)as; 88 } 89 else if (as instanceof ASN1Sequence) 90 { 91 return new PolicyQualifierInfo((ASN1Sequence)as); 92 } 93 94 throw new IllegalArgumentException ("unknown object in getInstance."); 95 } 96 97 102 public DERObject toASN1Object() 103 { 104 ASN1EncodableVector dev = new ASN1EncodableVector(); 105 dev.add(policyQualifierId); 106 dev.add(qualifier); 107 108 return new DERSequence(dev); 109 } 110 } 111 | Popular Tags |