blob: 10522c2f75d01fb7de4438fb4d38e798a402856f (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
|
package org.bouncycastle.asn1.cmp;
import org.bouncycastle.asn1.ASN1EncodableVector;
import org.bouncycastle.asn1.DERSequence;
import org.bouncycastle.asn1.DERTaggedObject;
import org.bouncycastle.asn1.crmf.CertId;
import org.bouncycastle.asn1.x509.CertificateList;
public class RevRepContentBuilder
{
private ASN1EncodableVector status = new ASN1EncodableVector();
private ASN1EncodableVector revCerts = new ASN1EncodableVector();
private ASN1EncodableVector crls = new ASN1EncodableVector();
public RevRepContentBuilder add(PKIStatusInfo status)
{
this.status.add(status);
return this;
}
public RevRepContentBuilder add(PKIStatusInfo status, CertId certId)
{
if (this.status.size() != this.revCerts.size())
{
throw new IllegalStateException("status and revCerts sequence must be in common order");
}
this.status.add(status);
this.revCerts.add(certId);
return this;
}
public RevRepContentBuilder addCrl(CertificateList crl)
{
this.crls.add(crl);
return this;
}
public RevRepContent build()
{
ASN1EncodableVector v = new ASN1EncodableVector();
v.add(new DERSequence(status));
if (revCerts.size() != 0)
{
v.add(new DERTaggedObject(true, 0, new DERSequence(revCerts)));
}
if (crls.size() != 0)
{
v.add(new DERTaggedObject(true, 1, new DERSequence(crls)));
}
return RevRepContent.getInstance(new DERSequence(v));
}
}
|