You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Here is a basic example of how to use the classes in Org.BouncyCastle.Tsp to send a TSP request to a server and collect the response:
TimeStampRequestGeneratorreqGen=newTimeStampRequestGenerator();// Dummy requestTimeStampRequestrequest=reqGen.Generate(TspAlgorithms.Sha1,newbyte[20],BigInteger.ValueOf(100));byte[]reqData=request.GetEncoded();HttpWebRequesthttpReq=(HttpWebRequest)WebRequest.Create("http://www.cryptopro.ru/tsp/tsp.srf");httpReq.Method="POST";httpReq.ContentType="application/timestamp-query";httpReq.ContentLength=reqData.Length;// Write the request contentStreamreqStream=httpReq.GetRequestStream();reqStream.Write(reqData,0,reqData.Length);reqStream.Close();HttpWebResponsehttpResp=(HttpWebResponse)httpReq.GetResponse();// Read the responseStreamrespStream=newBufferedStream(httpResp.GetResponseStream());TimeStampResponseresponse=newTimeStampResponse(respStream);respStream.Close();