01: package org.bouncycastle.asn1.pkcs;
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.DERObjectIdentifier;
08: import org.bouncycastle.asn1.DERSequence;
09: import org.bouncycastle.asn1.DERTaggedObject;
10:
11: public class CertBag extends ASN1Encodable {
12: ASN1Sequence seq;
13: DERObjectIdentifier certId;
14: DERObject certValue;
15:
16: public CertBag(ASN1Sequence seq) {
17: this .seq = seq;
18: this .certId = (DERObjectIdentifier) seq.getObjectAt(0);
19: this .certValue = ((DERTaggedObject) seq.getObjectAt(1))
20: .getObject();
21: }
22:
23: public CertBag(DERObjectIdentifier certId, DERObject certValue) {
24: this .certId = certId;
25: this .certValue = certValue;
26: }
27:
28: public DERObjectIdentifier getCertId() {
29: return certId;
30: }
31:
32: public DERObject getCertValue() {
33: return certValue;
34: }
35:
36: public DERObject toASN1Object() {
37: ASN1EncodableVector v = new ASN1EncodableVector();
38:
39: v.add(certId);
40: v.add(new DERTaggedObject(0, certValue));
41:
42: return new DERSequence(v);
43: }
44: }
|