1

I am new on Bouncycastle. I can get timeStampToken from TSA server with http connection.

InputStream in = con.getInputStream();
TimeStampResp resp = TimeStampResp.getInstance(new ASN1InputStream(in).readObject());
TimeStampResponse response = new TimeStampResponse(resp);
response.validate(timeStampRequest);


InputStream in = con.getInputStream();
TimeStampResp resp = TimeStampResp.getInstance(new ASN1InputStream(in).readObject());

TimeStampResponse response = new TimeStampResponse(resp);
response.validate(timeStampRequest);

Next, I must generate a file from the TimeStampResponse object. The generated files with other client applications has CRL / OCSP url informations but my file does not have this informations. How can i generate this file?

FileOutputStream fos;
try {
    fos = new FileOutputStream(
            "C:/FORM-003.pdf.tst");
    fos.write(response.getEncoded());
    fos.close();
} catch (FileNotFoundException e) {
    e.printStackTrace();
} catch (IOException e) {
    e.printStackTrace();
}

Thanks for your helps.

egor.zhdan
  • 4,555
  • 6
  • 39
  • 53
mns45
  • 103
  • 7

1 Answers1

1

My timestamp request must have "certReq" attribute to get response which I want.

TimeStampRequestGenerator timeStampRequestGenerator = new TimeStampRequestGenerator();
timeStampRequestGenerator.setCertReq(true);
N00b Pr0grammer
  • 4,503
  • 5
  • 32
  • 46
mns45
  • 103
  • 7