01: package org.bouncycastle.asn1.crmf;
02:
03: import org.bouncycastle.asn1.ASN1Choice;
04: import org.bouncycastle.asn1.ASN1Encodable;
05: import org.bouncycastle.asn1.ASN1TaggedObject;
06: import org.bouncycastle.asn1.DERObject;
07: import org.bouncycastle.asn1.DERTaggedObject;
08:
09: public class ProofOfPossession extends ASN1Encodable implements
10: ASN1Choice {
11: private int tagNo;
12: private ASN1Encodable obj;
13:
14: private ProofOfPossession(ASN1TaggedObject tagged) {
15: tagNo = tagged.getTagNo();
16: }
17:
18: public static ProofOfPossession getInstance(Object o) {
19: if (o instanceof ProofOfPossession) {
20: return (ProofOfPossession) o;
21: }
22:
23: if (o instanceof ASN1TaggedObject) {
24: return new ProofOfPossession((ASN1TaggedObject) o);
25: }
26:
27: throw new IllegalArgumentException("Invalid object: "
28: + o.getClass().getName());
29: }
30:
31: /**
32: * <pre>
33: * ProofOfPossession ::= CHOICE {
34: * raVerified [0] NULL,
35: * -- used if the RA has already verified that the requester is in
36: * -- possession of the private key
37: * signature [1] POPOSigningKey,
38: * keyEncipherment [2] POPOPrivKey,
39: * keyAgreement [3] POPOPrivKey }
40: * </pre>
41: * @return a basic ASN.1 object representation.
42: */
43: public DERObject toASN1Object() {
44: return new DERTaggedObject(tagNo, obj);
45: }
46: }
|