01: package org.bouncycastle.asn1.cmp;
02:
03: import org.bouncycastle.asn1.ASN1Encodable;
04: import org.bouncycastle.asn1.ASN1EncodableVector;
05: import org.bouncycastle.asn1.ASN1Sequence;
06: import org.bouncycastle.asn1.DERObject;
07: import org.bouncycastle.asn1.DERSequence;
08:
09: public class CAKeyUpdAnnContent extends ASN1Encodable {
10: private CMPCertificate oldWithNew;
11: private CMPCertificate newWithOld;
12: private CMPCertificate newWithNew;
13:
14: private CAKeyUpdAnnContent(ASN1Sequence seq) {
15: oldWithNew = CMPCertificate.getInstance(seq.getObjectAt(0));
16: newWithOld = CMPCertificate.getInstance(seq.getObjectAt(1));
17: newWithNew = CMPCertificate.getInstance(seq.getObjectAt(2));
18: }
19:
20: public static CAKeyUpdAnnContent getInstance(Object o) {
21: if (o instanceof CAKeyUpdAnnContent) {
22: return (CAKeyUpdAnnContent) o;
23: }
24:
25: if (o instanceof ASN1Sequence) {
26: return new CAKeyUpdAnnContent((ASN1Sequence) o);
27: }
28:
29: throw new IllegalArgumentException("Invalid object: "
30: + o.getClass().getName());
31: }
32:
33: public CMPCertificate getOldWithNew() {
34: return oldWithNew;
35: }
36:
37: public CMPCertificate getNewWithOld() {
38: return newWithOld;
39: }
40:
41: public CMPCertificate getNewWithNew() {
42: return newWithNew;
43: }
44:
45: /**
46: * <pre>
47: * CAKeyUpdAnnContent ::= SEQUENCE {
48: * oldWithNew CMPCertificate, -- old pub signed with new priv
49: * newWithOld CMPCertificate, -- new pub signed with old priv
50: * newWithNew CMPCertificate -- new pub signed with new priv
51: * }
52: * </pre>
53: * @return a basic ASN.1 object representation.
54: */
55: public DERObject toASN1Object() {
56: ASN1EncodableVector v = new ASN1EncodableVector();
57:
58: v.add(oldWithNew);
59: v.add(newWithOld);
60: v.add(newWithNew);
61:
62: return new DERSequence(v);
63: }
64: }
|