admin管理员组

文章数量:1122846

I'm trying to sign a pdf (converted to a hash) using . So far I'm sending the TSR, and receive a binary response like so.

So far so good. Now let's parse:

I then (upon validation) I attempt to decode the binary response I received from the freetsa endpoint (using the validateTimestamp method) but I'm having trouble parsing the decoded response.

The problem:

Specifically in this line:

$parsed = ASN1::asn1map($decoded[0], $schema)

I'm getting an empty response ($parsed is empty), and the reason is the schema that I'm passing is incorrect.

What I already tried:

I tried using the RFC3161 schema but I couldn't get it to work (still empty responses), so I attempted building the schema from scratch. To the best of my ability, so far I've only been able to create this schema, but it's not complete.

Where I'm at now:

Now the $parsed variable is not empty, but there's still some data that need to be parsed too (the schema I'm passing is not complete yet).

There has to be an easier way to parse the TSR in php, I don't believe everyone is going through the hustle of trying to figure out the schema manually. It's very strict and unforgiving and even a single mistake results in parse errors.

Q:

Is there a better way to decode the response in php? (or at least to get the schema correct 100%?)

p.s: I do have the response of freetsa (.tsr) and the decoded output of openssl ts -reply -in response.tsr -text in case that helps.

Thanks

本文标签: How to properly decode the (timestamp signature) response of freetsaorg TSR in PHPStack Overflow