[erlang-questions] ASN1 exclusive decode failure
Bram Verburg
bram.verburg@REDACTED
Mon Sep 23 08:48:18 CEST 2019
Hi,
I'm trying to decode an OCSP basic response:
BasicOCSPResponse ::= SEQUENCE {
tbsResponseData ResponseData,
signatureAlgorithm AlgorithmIdentifier,
signature BIT STRING,
certs [0] EXPLICIT SEQUENCE OF Certificate OPTIONAL }
I would like the 'certs' element to be returned as-is, basically as a list
of DER certificates which I may or may not decode later. I was hoping I
could use 'exclusive_decode', with the following asn1config:
{exclusive_decode,{ocsp,[
{decode_basic_ocsp_response,['BasicOCSPResponse',[{certs,parts}]]}
]}}.
But this fails with the following exception:
** exception error: no function clause matching
ocsp:decode_tag_and_length({asn1,"tag failure",16,
{1,131072,
<<48,130,4,232,48,130,4,228,48,130,3,204,160,3,2,1,2,2,9,
0,227,...>>,
<<>>}})
(ocsp.erl, line 2051)
in function ocsp:decode_primitive_incomplete/2 (ocsp.erl, line 2026)
in call from ocsp:decode_constructed_incomplete/2 (ocsp.erl, line 1828)
in call from ocsp:decode_constructed_incomplete/2 (ocsp.erl, line 1830)
in call from ocsp:decode_constructed_incomplete/2 (ocsp.erl, line 1808)
in call from ocsp:decode_incomplete2/5 (ocsp.erl, line 21848)
in call from ocsp:decode_partial_incomplete/3 (ocsp.erl, line 1190)
A full BasicOCSPResponse decode of the same binary works fine, returning a
list of Certificate records in the certs element, so the source data is
valid.
Is there any reason why the exclusive_decode 'parts' action might not work
for this particular SEQUENCE, perhaps because it is explicit + optional?
Thanks,
Bram
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://erlang.org/pipermail/erlang-questions/attachments/20190923/11f73f64/attachment.htm>
More information about the erlang-questions
mailing list