01: package org.bouncycastle.asn1.esf;
02:
03: import org.bouncycastle.asn1.*;
04:
05: public class SigPolicyQualifiers extends ASN1Encodable {
06: ASN1Sequence qualifiers;
07:
08: public static SigPolicyQualifiers getInstance(Object obj) {
09: if (obj instanceof SigPolicyQualifiers) {
10: return (SigPolicyQualifiers) obj;
11: } else if (obj instanceof ASN1Sequence) {
12: return new SigPolicyQualifiers((ASN1Sequence) obj);
13: }
14:
15: throw new IllegalArgumentException(
16: "unknown object in 'SigPolicyQualifiers' factory: "
17: + obj.getClass().getName() + ".");
18: }
19:
20: public SigPolicyQualifiers(ASN1Sequence seq) {
21: qualifiers = seq;
22: }
23:
24: public SigPolicyQualifiers(SigPolicyQualifierInfo[] qualifierInfos) {
25: ASN1EncodableVector v = new ASN1EncodableVector();
26: for (int i = 0; i < qualifierInfos.length; i++) {
27: v.add(qualifierInfos[i]);
28: }
29: qualifiers = new DERSequence(v);
30: }
31:
32: /**
33: * Return the number of qualifier info elements present.
34: *
35: * @return number of elements present.
36: */
37: public int size() {
38: return qualifiers.size();
39: }
40:
41: /**
42: * Return the SigPolicyQualifierInfo at index i.
43: *
44: * @param i index of the string of interest
45: * @return the string at index i.
46: */
47: public SigPolicyQualifierInfo getStringAt(int i) {
48: return SigPolicyQualifierInfo.getInstance(qualifiers
49: .getObjectAt(i));
50: }
51:
52: /**
53: * <pre>
54: * SigPolicyQualifiers ::= SEQUENCE SIZE (1..MAX) OF SigPolicyQualifierInfo
55: * </pre>
56: */
57: public DERObject toASN1Object() {
58: return qualifiers;
59: }
60: }
|