Using Bouncy Castle and C#, I am requesting a timestamp token with the certificates included (timestampRequestGenerator.SetCertReq(true)
) and I get a response significantly bigger than when setting SetCertReq
to false
, so I assume that the response has somewhere the public key certificates used to generate the timestamp.
How can I access those certificates using Bouncy Castle? I have explored the response object in Visual Studio but did not find where the certificates are.
Stream inputFile = File.OpenRead("response-with-certs.tsr");
TimeStampResponse response = new TimeStampResponse(inputFile);
inputFile.Close();
As mentioned in the comments, you should be able to retrieve the certificate collection like so:
response.TimeStampToken.GetCertificates("Collection");