Hi,

I reported this in the 'user' forum also as 'garbage-in garbage-out' - but 
not as a bug.

Looks like a BER encoded nonce in an OCSP request gets copied back in the 
response - the critical flag was 'false' which is the default so should 
not be encoded for DER. The signature appears to be computed over the 
actual encoding, which can be BER, not the DER encoding as specified in 
the RFC. Therefore the encodings are all legal but the OpenSSL signatures 
are not in this case.

I've seen this problem before and we always had to re-encode the object in 
DER before making or checking the signature.

I have confirmed that OpenSSL will return a non-BER encoded response to 
match the request.
I haven't confirmed how the OpenSSL signature is computed but I know that 
my code rejected the OpenSSL responses after I fixed it to do the sig over 
a correct DER encoding.

Attached is a response with the 'false' encoded in it - i.e. a non-DER 
request - not signed. The response comes back the same. If you send in a 
correct response, or let OpenSSL generate one then it is correctly DER 
encoded.

Ok, it is a pretty obscure bug and I only found it because I had a much 
worse bug - encoding defaults when it's supposed to be DER :-). But maybe 
this effect crops up elsewhere though.

Regards,

Simon McMahon

Attachment: notder.oreq
Description: Binary data

Attachment: test.orsp
Description: Binary data

Reply via email to