@Override
public byte[] getTimeStamp(final byte[] request) {
try {
TimeStampRequest timeStampRequest = new TimeStampRequest(request);
TimeStampResponseGenerator timeStampResponseGenerator = new TimeStampResponseGenerator(this.timeStampTokenGenerator, TSPAlgorithms.ALLOWED);
TimeStampResponse timeStampResponse = timeStampResponseGenerator.generate(timeStampRequest, this.getSerialNumber(), new Date());
timeStampResponse.validate(timeStampRequest);
return timeStampResponse.getEncoded();
} catch (Exception e) {