erlangelixirocsp

erlang/elixir parse OCSPResponse (asn.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?


Solution

  • elixir code

    with {:CertificateList, tbs_certs, _, _} <- 
    :public_key.der_decode(:CertificateList, data),
    {:TBSCertList, _, _, _, _, {:utcTime, ts}, certs, _} <- tbs_certs do
    ...
    end