1

Is there any way to parse OCSP response in erlang/elixir? Probably I don't understand something, but it is ASN.1 type OCSPResponse fails

 :public_key.der_decode(:OCSPResponse,data)

Also I have tried download and compile:

asn1ct:compile("/Users/edenlab/workspace/ocsp_client/ocsp.asn1", [ber, verbose]).

but it fails with a list of errors:

OCSP-2009:8: 'ATTRIBUTE' is not exported from PKIX-CommonTypes-2009
OCSP-2009:8: 'EXTENSION' is not exported from PKIX-CommonTypes-2009
...
OCSP-2009:180: illegal OBJECT IDENTIFIER
OCSP-2009:181: illegal OBJECT IDENTIFIER
{error,[{structured_error,{'OCSP-2009',8},
                          asn1ct_check,
                          {undefined_import,'ATTRIBUTE','PKIX-CommonTypes-2009'}},

Is there something like OCSP lib in Ruby?

Maryna Shabalina
  • 450
  • 3
  • 15

1 Answers1

0

elixir code

with {:CertificateList, tbs_certs, _, _} <- 
:public_key.der_decode(:CertificateList, data),
{:TBSCertList, _, _, _, _, {:utcTime, ts}, certs, _} <- tbs_certs do
...
end
Maryna Shabalina
  • 450
  • 3
  • 15
  • 1
    Can you add some explanation for future readers why does changing `:OCSPResponse` to `:CertificateList` solve the issue? – barbsan Sep 10 '19 at 09:22
  • I don't know how it solve it, and why asn1 is not works still a question, but check one of examples from http://erlang.org/doc/man/public_key.html helps :\ – Maryna Shabalina Sep 10 '19 at 09:31