01: package org.bouncycastle.asn1.crmf;
02:
03: import org.bouncycastle.asn1.ASN1Encodable;
04: import org.bouncycastle.asn1.ASN1Sequence;
05: import org.bouncycastle.asn1.DERObject;
06:
07: public class CertReqMessages extends ASN1Encodable {
08: private ASN1Sequence content;
09:
10: private CertReqMessages(ASN1Sequence seq) {
11: content = seq;
12: }
13:
14: public static CertReqMessages getInstance(Object o) {
15: if (o instanceof CertReqMessages) {
16: return (CertReqMessages) o;
17: }
18:
19: if (o instanceof ASN1Sequence) {
20: return new CertReqMessages((ASN1Sequence) o);
21: }
22:
23: throw new IllegalArgumentException("Invalid object: "
24: + o.getClass().getName());
25: }
26:
27: public CertReqMsg[] toCertReqMsgArray() {
28: CertReqMsg[] result = new CertReqMsg[content.size()];
29:
30: for (int i = 0; i != result.length; i++) {
31: result[i] = CertReqMsg.getInstance(content.getObjectAt(i));
32: }
33:
34: return result;
35: }
36:
37: /**
38: * <pre>
39: * CertReqMessages ::= SEQUENCE SIZE (1..MAX) OF CertReqMsg
40: * </pre>
41: * @return a basic ASN.1 object representation.
42: */
43: public DERObject toASN1Object() {
44: return content;
45: }
46: }
|