Hello David,

you are most likely not taking "Kind" property of "DateTime" object [0]
into the account. My guess is that TSA response contains UTC time which
does not apply your timezone and daylight saving which seems to be exactly
2 hours in your case. You can use "ToLocalTime" method of "DateTime" class
[1] to convert UTC time to your local time.

[0]
https://msdn.microsoft.com/en-us/library/system.datetime.kind%28v=vs.100%29.aspx
[1]
https://msdn.microsoft.com/en-us/library/system.datetime.tolocaltime%28v=vs.100%29.aspx

-- 
Kind Regards / S pozdravom

Jaroslav Imrich
http://www.jimrich.sk
jaroslav.imr...@gmail.com



On Wed, Apr 29, 2015 at 4:57 PM, David Lestón <dles...@provimad.es> wrote:

> Hello everybody,
>
>
>
> I´m a user from Spain and I tried your dll (for free)the c# code to get
> the timestamp. When I read the time, this came to  me with 2 hours of
> difference and I don´t know if I need to put more parameters in order to
> get the correct time. I write this code:
>
>
>
> TimeStampRequestGenerator reqGen = new TimeStampRequestGenerator();
>
>
>
>                 TimeStampRequest request = reqGen.Generate(
>
>                 TspAlgorithms.Sha1, new byte[20], BigInteger.ValueOf(100));
>
>
>
>             byte[] reqData = request.GetEncoded();
>
>
>
>             HttpWebRequest httpReq = (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 content
>
>             Stream reqStream = httpReq.GetRequestStream();
>
>             reqStream.Write(reqData, 0, reqData.Length);
>
>             reqStream.Close();
>
>
>
>             HttpWebResponse httpResp =
> (HttpWebResponse)httpReq.GetResponse();
>
>
>
>             // Read the response
>
>             Stream respStream = new
> BufferedStream(httpResp.GetResponseStream());
>
>             TimeStampResponse response = new TimeStampResponse(respStream);
>
>             respStream.Close();
>
>
>
> Exist any form to get the correct tdate time?
>
>
>
> Thank you. Regards.
>
>
>
> David
>
>
>

Reply via email to