New generate methods have been introduced to give people more control over what ends up in the message. Unfortunately it turns out that in some cases fields like statusString must be left out otherwise a an otherwise valid timestamp will be rejected.
If you're after the most control with generating a response use:
TimeStampResponse tsResp;
try
{
tsResp = tsRespGen.generateGrantedResponse(request, new BigInteger("23"), new Date());
}
catch (Exception e)
{
tsResp = tsRespGen.generateRejectedResponse(e);
}
The generate method does this, but provides a status string of "Operation Okay".
It should be pointed out that generateRejectedResponse() may also, on very rare occasions throw a TSPException. In the event that happens, there's a serious internal problem with your responder.
| Modifier and Type | Class and Description |
|---|---|
| pack-priv static class |
| Modifier and Type | Field and Description |
|---|---|
| private Set | |
| private Set | |
| private Set | |
| pack-priv int | |
| pack-priv int | |
| pack-priv ASN1EncodableVector | |
| private TimeStampTokenGenerator |
| Access | Constructor and Description |
|---|---|
| public | TimeStampResponseGenerator(TimeStampTokenGenerator tokenGenerator, Set<E>
a set of OIDs giving accepted algorithms. acceptedAlgorithms)
|
| public | TimeStampResponseGenerator(TimeStampTokenGenerator tokenGenerator, Set<E>
a set of OIDs giving accepted algorithms. acceptedAlgorithms, Set<E> if non-null a set of policies OIDs we are willing to sign under. acceptedPolicies)
|
| public | TimeStampResponseGenerator(TimeStampTokenGenerator tokenGenerator, Set<E>
a set of OIDs giving accepted algorithms. acceptedAlgorithms, Set<E> if non-null a set of policies OIDs we are willing to sign under. acceptedPolicies, Set<E> if non-null a set of extensions OIDs we are willing to accept. acceptedExtensions)
|
| Modifier and Type | Method and Description |
|---|---|
| private void | |
| private Set | |
| public TimeStampResponse | Returns: a TimeStampResponse.the request this response is for. request, BigInteger serial number for the response token. serialNumber, Date generation time for the response token. genTime)Return an appropriate TimeStampResponse. |
| public TimeStampResponse | Returns: a TimeStampResponse with a failInfoField and optional statusStringthe PKIStatus to set. status, int the FailInfoField to set. failInfoField, String an optional string describing the failure. statusString)Generate a non-granted TimeStampResponse with chosen status and FailInfoField. |
| public TimeStampResponse | Returns: the TimeStampResponse with a status of PKIStatus.GRANTEDthe request this response is for. request, BigInteger serial number for the response token. serialNumber, Date generation time for the response token. genTime)Return a granted response, if the passed in request passes validation. |
| public TimeStampResponse | Returns: the TimeStampResponse with a status of PKIStatus.GRANTEDthe request this response is for. request, BigInteger serial number for the response token. serialNumber, Date generation time for the response token. genTime, String statusString)Return a granted response, if the passed in request passes validation with the passed in status string. |
| public TimeStampResponse | Returns: the TimeStampResponse with a status of PKIStatus.GRANTEDthe request this response is for. request, BigInteger serial number for the response token. serialNumber, Date generation time for the response token. genTime, String statusString, Extensions extra extensions to be added to the response token. additionalExtensions)Return a granted response, if the passed in request passes validation with the passed in status string and extra extensions. |
| public TimeStampResponse | Returns: a TimeStampResponse.the exception thrown on validating the request. exception)Generate a generic rejection response based on a TSPValidationException or an Exception. |
| private PKIStatusInfo | |
| private void |
| acceptedAlgorithms | back to summary |
|---|---|
| private Set<E> acceptedAlgorithms | |
| acceptedExtensions | back to summary |
|---|---|
| private Set<E> acceptedExtensions | |
| acceptedPolicies | back to summary |
|---|---|
| private Set<E> acceptedPolicies | |
| failInfo | back to summary |
|---|---|
| pack-priv int failInfo | |
| status | back to summary |
|---|---|
| pack-priv int status | |
| statusStrings | back to summary |
|---|---|
| pack-priv ASN1EncodableVector statusStrings | |
| tokenGenerator | back to summary |
|---|---|
| private TimeStampTokenGenerator tokenGenerator | |
| TimeStampResponseGenerator | back to summary |
|---|---|
public TimeStampResponseGenerator(TimeStampTokenGenerator tokenGenerator, Set<E> acceptedAlgorithms)
| |
| TimeStampResponseGenerator | back to summary |
|---|---|
| public TimeStampResponseGenerator(TimeStampTokenGenerator tokenGenerator, Set<E> acceptedAlgorithms, Set<E> acceptedPolicies) | |
| TimeStampResponseGenerator | back to summary |
|---|---|
| public TimeStampResponseGenerator(TimeStampTokenGenerator tokenGenerator, Set<E> acceptedAlgorithms, Set<E> acceptedPolicies, Set<E> acceptedExtensions) | |
| addStatusString | back to summary |
|---|---|
| private void addStatusString(String statusString) | |
| convert | back to summary |
|---|---|
| private Set | |
| generate | back to summary |
|---|---|
| public TimeStampResponse generate(TimeStampRequest request, BigInteger serialNumber, Date genTime) throws TSPException Return an appropriate TimeStampResponse. If genTime is null a timeNotAvailable error response will be returned. Calling generate() is the equivalent of:
TimeStampResponse tsResp;
try
{
tsResp = tsRespGen.generateGrantedResponse(request, serialNumber, genTime, "Operation Okay");
}
catch (Exception e)
{
tsResp = tsRespGen.generateRejectedResponse(e);
}
| |
| generateFailResponse | back to summary |
|---|---|
| public TimeStampResponse generateFailResponse(int status, int failInfoField, String statusString) throws TSPException Generate a non-granted TimeStampResponse with chosen status and FailInfoField.
| |
| generateGrantedResponse | back to summary |
|---|---|
| public TimeStampResponse generateGrantedResponse(TimeStampRequest request, BigInteger serialNumber, Date genTime) throws TSPException Return a granted response, if the passed in request passes validation. If genTime is null a timeNotAvailable or a validation exception occurs a TSPValidationException will be thrown. The parent TSPException will only occur on some sort of system failure.
| |
| generateGrantedResponse | back to summary |
|---|---|
| public TimeStampResponse generateGrantedResponse(TimeStampRequest request, BigInteger serialNumber, Date genTime, String statusString) throws TSPException Return a granted response, if the passed in request passes validation with the passed in status string. If genTime is null a timeNotAvailable or a validation exception occurs a TSPValidationException will be thrown. The parent TSPException will only occur on some sort of system failure.
| |
| generateGrantedResponse | back to summary |
|---|---|
| public TimeStampResponse generateGrantedResponse(TimeStampRequest request, BigInteger serialNumber, Date genTime, String statusString, Extensions additionalExtensions) throws TSPException Return a granted response, if the passed in request passes validation with the passed in status string and extra extensions. If genTime is null a timeNotAvailable or a validation exception occurs a TSPValidationException will be thrown. The parent TSPException will only occur on some sort of system failure.
| |
| generateRejectedResponse | back to summary |
|---|---|
| public TimeStampResponse generateRejectedResponse(Exception exception) throws TSPException Generate a generic rejection response based on a TSPValidationException or an Exception. Exceptions which are not an instance of TSPValidationException will be treated as systemFailure. The return value of exception.getMessage() will be used as the status string for the response.
| |
| getPKIStatusInfo | back to summary |
|---|---|
| private PKIStatusInfo getPKIStatusInfo() | |
| setFailInfoField | back to summary |
|---|---|
| private void setFailInfoField(int field) | |
| Access | Constructor and Description |
|---|---|
| pack-priv |
| FailInfo | back to summary |
|---|---|
| pack-priv FailInfo(int failInfoValue) | |