[TSA] i2d TS_RESP problem

classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view

[TSA] i2d TS_RESP problem



I have already written an OCSP server, now I want to write TSA server. I thought I would reuse some code, bot it is not so easy. I have problem with converting TR_RESP structure into DER format. In OCSP server i used the following function:

i2d_OCSP_RESPONSE_bio(_cbio, _resp);

where _cbio is BIO (socket) and _resp is OCSP_RESPONSE structure. So, I wanted to send my TS_RESP structure in the same way, but the function is not the same as for the OCSP structure.

i2d_TS_RESP_bio(_cbio, _resp); // resp is TS_RESP structure

However, _resp structure seems to be filled correctly, function:

TS_RESP_print_bio(out, _resp);

gives the following output:

Status info:

Status: Granted.

Status description: unspecified

Failure info: unspecified

TST info:

Version: 1

Policy OID: 1.3.9

Hash Algorithm: sha1

Message data:

0000 - 09 17 ff 9e b0 53 47 44-39 5e 2e 7a c1 8f 64 c2 .....SGD9^.z..d.

0010 - b9 8f 97 06 ....

Serial number: 0x14

Time stamp: Aug 17 13:39:43 2005 GMT

Accuracy: unspecified

Ordering: yes

Nonce: 0x08B6

TSA: unspecified


The function i2d_TS_RESP(_resp, NULL) always returnes 7, no matter _resp structure has status Granted with TST info included or status Rejected without the TST info included.

I discovered thad there is another function i2d_TS_TST_INFO_bio(out, tst_info) that converts only the TS_TST_INFO structure.

So now is my question (finally) - how can I store TS_RESP structure, containing TST info, that will be possible to read and show with:

openssl ts -reply -in response.re -text

I suppose I have to write status info with i2d_TS_RESP_bio and after that TST info with i2d_TS_TST_INFO_bio, but the file created causes sementation fault when I am trying to open it with 'openssl ts'.

It only works, when i use i2d_TS_RESP_bio with Rejected status without TST info.