1 17 18 package org.apache.geronimo.util.asn1.x509; 19 20 import org.apache.geronimo.util.asn1.ASN1EncodableVector; 21 import org.apache.geronimo.util.asn1.ASN1Sequence; 22 import org.apache.geronimo.util.asn1.ASN1Encodable; 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 public class PolicyInformation 28 extends ASN1Encodable 29 { 30 private DERObjectIdentifier policyIdentifier; 31 private ASN1Sequence policyQualifiers; 32 33 public PolicyInformation( 34 ASN1Sequence seq) 35 { 36 policyIdentifier = (DERObjectIdentifier)seq.getObjectAt(0); 37 38 if (seq.size() > 1) 39 { 40 policyQualifiers = (ASN1Sequence)seq.getObjectAt(1); 41 } 42 } 43 44 public PolicyInformation( 45 DERObjectIdentifier policyIdentifier) 46 { 47 this.policyIdentifier = policyIdentifier; 48 } 49 50 public PolicyInformation( 51 DERObjectIdentifier policyIdentifier, 52 ASN1Sequence policyQualifiers) 53 { 54 this.policyIdentifier = policyIdentifier; 55 this.policyQualifiers = policyQualifiers; 56 } 57 58 public static PolicyInformation getInstance( 59 Object obj) 60 { 61 if (obj == null || obj instanceof PolicyInformation) 62 { 63 return (PolicyInformation)obj; 64 } 65 66 return new PolicyInformation(ASN1Sequence.getInstance(obj)); 67 } 68 69 public DERObjectIdentifier getPolicyIdentifier() 70 { 71 return policyIdentifier; 72 } 73 74 public ASN1Sequence getPolicyQualifiers() 75 { 76 return policyQualifiers; 77 } 78 79 85 public DERObject toASN1Object() 86 { 87 ASN1EncodableVector v = new ASN1EncodableVector(); 88 89 v.add(policyIdentifier); 90 91 if (policyQualifiers != null) 92 { 93 v.add(policyQualifiers); 94 } 95 96 return new DERSequence(v); 97 } 98 } 99 | Popular Tags |