开发者

using curl with trusted timestampgin

开发者 https://www.devze.com 2023-02-27 19:23 出处:网络
I would like to use the curl library, to get the trusted timestamp of a message. The command I use is the following:

I would like to use the curl library, to get the trusted timestamp of a message. The command I use is the following:

curl --data-binary @inputfile http://url_to_test_tsa --header "Content-type: application/timestamp-requ开发者_JS百科est"

The problem is, that whatever tsa (timestamping authority) I use, I always get back a server error. The content of @inputfile is a 40 character length sha1 or md5 hash.

What might be the problem?


From the man page: This posts data exactly as specified with no extra processing whatsoever

So if you use that option, you need to do the processing yourself.


basing on this original post and making a few correction, I ended up with the following simplified script to get a somewhat valid reply from a Timestamping Authority (given that I've created example.txt file with some gibberish):

openssl ts -query -data example.txt -cert -sha256 -out request.tsq
curl -H "Content-Type:application/timestamp-query" --data-binary @request.tsq http://demo.sk.ee/tsa --output response.tsr

note that some timestamping services behave differently - e.g. the one I used as an example above doesn't like a timestamping request created using SHA-1 algorithm for the hash (i.e. the output of above openssl command without -sha256 parameter). Also it seems that the header supplied above is not mandatory, i.e. both services I tried replied with valid response when I didn't use the header at all. Here's openssl ts man page.

0

精彩评论

暂无评论...
验证码 换一张
取 消