1
10package org.jstk.pki;
11
12import java.io.*;
13
14import org.jstk.asn1.*;
15import org.jstk.pem.*;
16import java.math.BigInteger;
17
18
33public class TBSCertList extends ASN1Seq{
34 public static class RevokedCert extends ASN1Seq {
35 public ASN1Integer userCertificate = new ASN1Integer();
36 public ASN1UTCTime revocationDate = new ASN1UTCTime();
37 public ASN1Seq crlEntryExtensions = new ASN1Seq();
38
39 public RevokedCert(){
40 super();
41 crlEntryExtensions.setOptional(true);
42
43 add(userCertificate);
44 add(revocationDate);
45 add(crlEntryExtensions);
46 }
47 public ASN1Integer getUserCertificate(){
48 return userCertificate;
49 }
50
51 public ASN1UTCTime getRevocationDate(){
52 return revocationDate;
53 }
54
55 public ASN1Seq getCRLEntryExtensions(){
56 return crlEntryExtensions;
57 }
58 }
59
60 public static class RevokedCerts extends ASN1Seq {
61 public RevokedCerts(){
62 super();
63 }
64 }
65
66 private ASN1Integer version = new ASN1Integer();
67 private AlgorithmIdentifier algorithm = new AlgorithmIdentifier();
68 private Name issuer = new Name();
69 private ASN1UTCTime thisUpdate = new ASN1UTCTime();
70 private ASN1UTCTime nextUpdate = new ASN1UTCTime();
71 private RevokedCerts revokedCerts = new RevokedCerts();
72 private ASN1Explicit crlExtensions = new ASN1Explicit(CONTEXT, EXPLICIT, 0);
73
74 public TBSCertList(){
75 super();
76 version.setOptional(true);
77 nextUpdate.setOptional(true);
78 revokedCerts.setOptional(true);
79 crlExtensions.setOptional(true);
80
81 add(version);
82 add(algorithm);
83 add(issuer);
84 add(thisUpdate);
85 add(nextUpdate);
86 add(revokedCerts);
87 add(crlExtensions);
88 }
89
90 public ASN1Integer getVersion(){
91 return version;
92 }
93
94 public AlgorithmIdentifier getAlgorithm(){
95 return algorithm;
96 }
97
98 public Name getIssuer(){
99 return issuer;
00 }
01
02 public ASN1UTCTime getThisUpdate(){
03 return thisUpdate;
04 }
05
06 public ASN1UTCTime getNextUpdate(){
07 return nextUpdate;
08 }
09
10 public RevokedCerts getRevokedCerts(){
11 return revokedCerts;
12 }
13
14 public ASN1Explicit getCRLExtensions(){
15 return crlExtensions;
16 }
17
18 public String toString(){
19 StringBuffer sb = new StringBuffer();
20 sb.append("TBSCertList-SEQ(" + version.toString() + ", ");
21 sb.append(algorithm.toString());
22 sb.append(", " + issuer.toString() + ", " + thisUpdate.toString());
23 sb.append(", " + nextUpdate.toString() + ", " + revokedCerts.toString() +
24 crlExtensions.toString() + ")");
25 return sb.toString();
26 }
27}
28
29