01: package org.bouncycastle.asn1.esf;
02:
03: import org.bouncycastle.asn1.*;
04:
05: public class SigPolicyQualifierInfo extends ASN1Encodable {
06: private DERObjectIdentifier sigPolicyQualifierId;
07: private DEREncodable sigQualifier;
08:
09: public SigPolicyQualifierInfo(
10: DERObjectIdentifier sigPolicyQualifierId,
11: DEREncodable sigQualifier) {
12: this .sigPolicyQualifierId = sigPolicyQualifierId;
13: this .sigQualifier = sigQualifier;
14: }
15:
16: public SigPolicyQualifierInfo(ASN1Sequence seq) {
17: sigPolicyQualifierId = DERObjectIdentifier.getInstance(seq
18: .getObjectAt(0));
19: sigQualifier = seq.getObjectAt(1);
20: }
21:
22: public static SigPolicyQualifierInfo getInstance(Object obj) {
23: if (obj == null || obj instanceof SigPolicyQualifierInfo) {
24: return (SigPolicyQualifierInfo) obj;
25: } else if (obj instanceof ASN1Sequence) {
26: return new SigPolicyQualifierInfo((ASN1Sequence) obj);
27: }
28:
29: throw new IllegalArgumentException(
30: "unknown object in 'SigPolicyQualifierInfo' factory: "
31: + obj.getClass().getName() + ".");
32: }
33:
34: public DERObjectIdentifier getSigPolicyQualifierId() {
35: return sigPolicyQualifierId;
36: }
37:
38: public DEREncodable getSigQualifier() {
39: return sigQualifier;
40: }
41:
42: /**
43: * <pre>
44: * SigPolicyQualifierInfo ::= SEQUENCE {
45: * sigPolicyQualifierId SigPolicyQualifierId,
46: * sigQualifier ANY DEFINED BY sigPolicyQualifierId }
47: *
48: * SigPolicyQualifierId ::= OBJECT IDENTIFIER
49: * </pre>
50: */
51: public DERObject toASN1Object() {
52: ASN1EncodableVector v = new ASN1EncodableVector();
53:
54: v.add(sigPolicyQualifierId);
55: v.add(sigQualifier);
56:
57: return new DERSequence(v);
58: }
59: }
|