Skip to content

Commit

Permalink
public_key: exclusive_decode config & data
Browse files Browse the repository at this point in the history
  • Loading branch information
u3s committed Nov 7, 2023
1 parent 1e7bdfb commit 5a75c29
Show file tree
Hide file tree
Showing 4 changed files with 29 additions and 4 deletions.
Binary file added lib/public_key/BasicOcspResponse.data
Binary file not shown.
13 changes: 13 additions & 0 deletions lib/public_key/README.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
{ok, Bin} = file:read_file("BasicOcspResponse.data").

%% decode everything
public_key:der_decode('BasicOCSPResponse', Bin).

%% decode but not signature
'OTP-PUB-KEY':decode_BasicOCSPResponse_exclusive1(Bin).

%% decode but not certs - 'parts' crashes with function_clause: 'OTP-PUB-KEY':decode_tag_and_length({asn1,"tag failure"
'OTP-PUB-KEY':decode_BasicOCSPResponse_exclusive2(Bin).

%% decode but not certs - 'undecoded' returns error but shouldn't?
'OTP-PUB-KEY':decode_BasicOCSPResponse_exclusive3(Bin).
3 changes: 2 additions & 1 deletion lib/public_key/asn1/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ EBIN = ../ebin
ASN_TOP = OTP-PUB-KEY PKCS-FRAME
ASN_MODULES = PKIX1Explicit88 PKIX1Implicit88 PKIX1Algorithms88 \
PKIXAttributeCertificate PKCS-1 PKCS-3 PKCS-7 PKCS-8 PKCS-10 PKCS5v2-0 OTP-PKIX \
InformationFramework RFC5639 CMSAesRsaesOaep
InformationFramework RFC5639 CMSAesRsaesOaep OCSP-2013-88
ASN_ASNS = $(ASN_MODULES:%=%.asn1)
ASN_ERLS = $(ASN_TOP:%=$(ESRC)/%.erl)
ASN_HRLS = $(ASN_TOP:%=%.hrl)
Expand Down Expand Up @@ -124,6 +124,7 @@ OTP-PUB-KEY.asn1db: PKIX1Algorithms88.asn1 \
PKCS-7.asn1\
PKCS-10.asn1\
InformationFramework.asn1\
OCSP-2013-88.asn1\
OTP-PKIX.asn1 \
RFC5639.asn1

Expand Down
17 changes: 14 additions & 3 deletions lib/public_key/asn1/OTP-PUB-KEY.asn1config
Original file line number Diff line number Diff line change
@@ -1,3 +1,14 @@
{exclusive_decode,{'OTP-PUB-KEY',
[{decode_TBSCert_exclusive,['Certificate',[{tbsCertificate,undecoded}]]},
{decode_TBSCertList_exclusive,['CertificateList',[{tbsCertList,undecoded}]]}]}}.
{exclusive_decode,
{'OTP-PUB-KEY',
[
{decode_TBSCert_exclusive,
['Certificate',[{tbsCertificate,undecoded}]]},
%% {decode_TBSCertList_exclusive2,
%% ['CertificateList',[{tbsCertList,undecoded}]]},
{decode_BasicOCSPResponse_exclusive1,
['BasicOCSPResponse',[{signature,undecoded}]]}
%% ,{decode_BasicOCSPResponse_exclusive2, % FIXME1
%% ['BasicOCSPResponse',[{certs,undecoded}]]}
%% ,{decode_BasicOCSPResponse_exclusive2, % FIXME2
%% ['BasicOCSPResponse',[{certs,parts}]]}
]}}.

0 comments on commit 5a75c29

Please sign in to comment.