1 20 package com.novosec.pkix.asn1.cmp; 21 22 import org.bouncycastle.asn1.ASN1EncodableVector; 23 import org.bouncycastle.asn1.ASN1Sequence; 24 import org.bouncycastle.asn1.ASN1TaggedObject; 25 import org.bouncycastle.asn1.DEREncodable; 26 import org.bouncycastle.asn1.DERObject; 27 import org.bouncycastle.asn1.DERSequence; 28 import org.bouncycastle.asn1.x509.X509CertificateStructure; 29 30 42 public class CAKeyUpdAnnContent implements DEREncodable 43 { 44 X509CertificateStructure oldWithNew; 45 X509CertificateStructure newWithOld; 46 X509CertificateStructure newWithNew; 47 48 public static CAKeyUpdAnnContent getInstance(ASN1TaggedObject obj, boolean explicit) 49 { 50 return getInstance(ASN1Sequence.getInstance(obj, explicit)); 51 } 52 53 public static CAKeyUpdAnnContent getInstance(Object obj) 54 { 55 if (obj instanceof CAKeyUpdAnnContent) 56 { 57 return (CAKeyUpdAnnContent) obj; 58 } 59 else if (obj instanceof ASN1Sequence) 60 { 61 return new CAKeyUpdAnnContent((ASN1Sequence) obj); 62 } 63 64 throw new IllegalArgumentException ("unknown object in factory"); 65 } 66 67 public CAKeyUpdAnnContent(ASN1Sequence seq) 68 { 69 this.oldWithNew = X509CertificateStructure.getInstance(seq.getObjectAt(0)); 70 this.newWithOld = X509CertificateStructure.getInstance(seq.getObjectAt(1)); 71 this.newWithNew = X509CertificateStructure.getInstance(seq.getObjectAt(2)); 72 } 73 74 public CAKeyUpdAnnContent( 75 X509CertificateStructure oldWithNew, 76 X509CertificateStructure newWithOld, 77 X509CertificateStructure newWithNew) 78 { 79 this.oldWithNew = oldWithNew; 80 this.newWithOld = newWithOld; 81 this.newWithNew = newWithNew; 82 } 83 84 public X509CertificateStructure getOldWithNew() 85 { 86 return oldWithNew; 87 } 88 89 public X509CertificateStructure getNewWithOld() 90 { 91 return newWithOld; 92 } 93 94 public X509CertificateStructure getNewWithNew() 95 { 96 return newWithNew; 97 } 98 99 public DERObject getDERObject() 100 { 101 ASN1EncodableVector v = new ASN1EncodableVector(); 102 103 v.add(oldWithNew); 104 v.add(newWithOld); 105 v.add(newWithNew); 106 107 return new DERSequence(v); 108 } 109 110 public String toString() 111 { 112 return "CAKeyUpdAnnContent: oldWithNew = " + this.getOldWithNew() + ", " + 113 "newWithOld = " + this.getNewWithOld() + ", " + 114 "newWithNew = " + this.getNewWithNew() + ")"; 115 } 116 } 117 | Popular Tags |