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