|
Bouncy Castle Cryptography Library 1.79 | ||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--org.bouncycastle.tsp.TimeStampResponseGenerator
Generator for RFC 3161 Time Stamp Responses.
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.
Constructor Summary | |
TimeStampResponseGenerator(TimeStampTokenGenerator tokenGenerator,
java.util.Set acceptedAlgorithms)
|
|
TimeStampResponseGenerator(TimeStampTokenGenerator tokenGenerator,
java.util.Set acceptedAlgorithms,
java.util.Set acceptedPolicies)
|
|
TimeStampResponseGenerator(TimeStampTokenGenerator tokenGenerator,
java.util.Set acceptedAlgorithms,
java.util.Set acceptedPolicies,
java.util.Set acceptedExtensions)
|
Method Summary | |
TimeStampResponse |
generate(TimeStampRequest request,
java.math.BigInteger serialNumber,
java.util.Date genTime)
Return an appropriate TimeStampResponse. |
TimeStampResponse |
generateFailResponse(int status,
int failInfoField,
java.lang.String statusString)
Generate a non-granted TimeStampResponse with chosen status and FailInfoField. |
TimeStampResponse |
generateGrantedResponse(TimeStampRequest request,
java.math.BigInteger serialNumber,
java.util.Date genTime)
Return a granted response, if the passed in request passes validation. |
TimeStampResponse |
generateGrantedResponse(TimeStampRequest request,
java.math.BigInteger serialNumber,
java.util.Date genTime,
java.lang.String statusString)
Return a granted response, if the passed in request passes validation with the passed in status string. |
TimeStampResponse |
generateGrantedResponse(TimeStampRequest request,
java.math.BigInteger serialNumber,
java.util.Date genTime,
java.lang.String statusString,
org.bouncycastle.asn1.x509.Extensions additionalExtensions)
Return a granted response, if the passed in request passes validation with the passed in status string and extra extensions. |
TimeStampResponse |
generateRejectedResponse(java.lang.Exception exception)
Generate a generic rejection response based on a TSPValidationException or an Exception. |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
public TimeStampResponseGenerator(TimeStampTokenGenerator tokenGenerator, java.util.Set acceptedAlgorithms)
tokenGenerator
- acceptedAlgorithms
- a set of OIDs giving accepted algorithms.public TimeStampResponseGenerator(TimeStampTokenGenerator tokenGenerator, java.util.Set acceptedAlgorithms, java.util.Set acceptedPolicies)
tokenGenerator
- acceptedAlgorithms
- a set of OIDs giving accepted algorithms.acceptedPolicies
- if non-null a set of policies OIDs we are willing to sign under.public TimeStampResponseGenerator(TimeStampTokenGenerator tokenGenerator, java.util.Set acceptedAlgorithms, java.util.Set acceptedPolicies, java.util.Set acceptedExtensions)
tokenGenerator
- acceptedAlgorithms
- a set of OIDs giving accepted algorithms.acceptedPolicies
- if non-null a set of policies OIDs we are willing to sign under.acceptedExtensions
- if non-null a set of extensions OIDs we are willing to accept.Method Detail |
public TimeStampResponse generate(TimeStampRequest request, java.math.BigInteger serialNumber, java.util.Date genTime) throws TSPException
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); }
request
- the request this response is for.serialNumber
- serial number for the response token.genTime
- generation time for the response token.TSPException
- public TimeStampResponse generateGrantedResponse(TimeStampRequest request, java.math.BigInteger serialNumber, java.util.Date genTime) throws TSPException
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.
request
- the request this response is for.serialNumber
- serial number for the response token.genTime
- generation time for the response token.TSPException
- on validation exception or internal error.public TimeStampResponse generateGrantedResponse(TimeStampRequest request, java.math.BigInteger serialNumber, java.util.Date genTime, java.lang.String statusString) throws TSPException
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.
request
- the request this response is for.serialNumber
- serial number for the response token.genTime
- generation time for the response token.TSPException
- on validation exception or internal error.public TimeStampResponse generateGrantedResponse(TimeStampRequest request, java.math.BigInteger serialNumber, java.util.Date genTime, java.lang.String statusString, org.bouncycastle.asn1.x509.Extensions additionalExtensions) throws TSPException
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.
request
- the request this response is for.serialNumber
- serial number for the response token.genTime
- generation time for the response token.additionalExtensions
- extra extensions to be added to the response token.TSPException
- on validation exception or internal error.public TimeStampResponse generateRejectedResponse(java.lang.Exception exception) throws TSPException
exception
- the exception thrown on validating the request.TSPException
- if a failure response cannot be generated.public TimeStampResponse generateFailResponse(int status, int failInfoField, java.lang.String statusString) throws TSPException
status
- the PKIStatus to set.failInfoField
- the FailInfoField to set.statusString
- an optional string describing the failure.TSPException
- in case the response could not be created
|
Bouncy Castle Cryptography Library 1.79 | ||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |