diff options
author | David Hook <dgh@cryptoworkshop.com> | 2014-03-19 04:12:15 +0400 |
---|---|---|
committer | David Hook <dgh@cryptoworkshop.com> | 2014-03-19 04:12:15 +0400 |
commit | fd22e5eef3c15ff7eb48386341289325ed961067 (patch) | |
tree | a8f716870d847a9613ceb234a3ef136c94f63d06 /pkix/src | |
parent | af4ac75432712f98940242862d1b5b242b93248c (diff) |
Added other revocation info setting.
Diffstat (limited to 'pkix/src')
-rw-r--r-- | pkix/src/main/java/org/bouncycastle/tsp/TimeStampTokenGenerator.java | 30 |
1 files changed, 27 insertions, 3 deletions
diff --git a/pkix/src/main/java/org/bouncycastle/tsp/TimeStampTokenGenerator.java b/pkix/src/main/java/org/bouncycastle/tsp/TimeStampTokenGenerator.java index 008ca951..91586c50 100644 --- a/pkix/src/main/java/org/bouncycastle/tsp/TimeStampTokenGenerator.java +++ b/pkix/src/main/java/org/bouncycastle/tsp/TimeStampTokenGenerator.java @@ -4,7 +4,10 @@ import java.io.IOException; import java.io.OutputStream; import java.math.BigInteger; import java.util.ArrayList; +import java.util.Collection; import java.util.Date; +import java.util.HashMap; +import java.util.Iterator; import java.util.List; import java.util.Map; @@ -83,6 +86,7 @@ public class TimeStampTokenGenerator private List certs = new ArrayList(); private List crls = new ArrayList(); private List attrCerts = new ArrayList(); + private Map otherRevoc = new HashMap(); private SignerInfoGenerator signerInfoGen; /** @@ -228,6 +232,19 @@ public class TimeStampTokenGenerator attrCerts.addAll(attrStore.getMatches(null)); } + /** + * Add a Store of otherRevocationData to the CRL set to be included with the generated TimeStampToken. + * + * @param otherRevocationInfoFormat the OID specifying the format of the otherRevocationInfo data. + * @param otherRevocationInfos a Store of otherRevocationInfo data to add. + */ + public void addOtherRevocationInfo( + ASN1ObjectIdentifier otherRevocationInfoFormat, + Store otherRevocationInfos) + { + otherRevoc.put(otherRevocationInfoFormat, otherRevocationInfos.getMatches(null)); + } + public void setAccuracySeconds(int accuracySeconds) { this.accuracySeconds = accuracySeconds; @@ -328,12 +345,19 @@ public class TimeStampTokenGenerator { // TODO: do we need to check certs non-empty? signedDataGenerator.addCertificates(new CollectionStore(certs)); - signedDataGenerator.addCRLs(new CollectionStore(crls)); signedDataGenerator.addAttributeCertificates(new CollectionStore(attrCerts)); } - else + + signedDataGenerator.addCRLs(new CollectionStore(crls)); + + if (!otherRevoc.isEmpty()) { - signedDataGenerator.addCRLs(new CollectionStore(crls)); + for (Iterator it = otherRevoc.keySet().iterator(); it.hasNext();) + { + ASN1ObjectIdentifier format = (ASN1ObjectIdentifier)it.next(); + + signedDataGenerator.addOtherRevocationInfo(format, new CollectionStore((Collection)otherRevoc.get(format))); + } } signedDataGenerator.addSignerInfoGenerator(signerInfoGen); |