使用Bouncy Castle和C#,我正在请求包含证书的时间戳令牌(timestampRequestGenerator.SetCertReq(true)
),并且我得到的响应明显大于将SetCertReq
设置为false
时的响应,因此我假设响应具有用于生成时间戳的公钥证书的某处。
如何使用Bouncy Castle访问这些证书?我已经在Visual Studio中探索了响应对象,但没有找到证书的位置。
Stream inputFile = File.OpenRead("response-with-certs.tsr");
TimeStampResponse response = new TimeStampResponse(inputFile);
inputFile.Close();
如评论中所述,您应该能够检索证书集合,如下所示:
response.TimeStampToken.GetCertificates("Collection");