-
Notifications
You must be signed in to change notification settings - Fork 3k
Description
Describe the bug
public_key:der_encodesupports InvalidityDate as ASN1 Extension Type but the underlying code in pubkey_cert_records:encode_extensions calls PKIX1Implicit-2009':getenc_CertExtensions(Id)
The issue seams to be that InvalidityDate is a CrlEntryExtension so getenc_CertExtensions does not support its ID.
Not even getenc_CrlExtensions does so, the only match for its ID I found it in getenc_CrlEntryExtensions
To Reproduce
Any shell on OTP 28.2
18> public_key:der_encode('InvalidityDate', "20220127000000Z").
** exception error: no case clause matching "20220127000000Z"
in function 'PKIX1Implicit-2009':'-getenc_CertExtensions/1-fun-0-'/3 (../src/PKIX1Implicit-2009.erl:3128)
in call from pubkey_cert_records:'-encode_extensions/1-fun-0-'/1 (pubkey_cert_records.erl:488)
in call from lists:map/2 (lists.erl:2385)
in call from public_key:der_encode/2 (public_key.erl:978)
Expected behavior
I would expect that all supported Asn1ExtType matched by the public API function are then supported by the internal libraries.
Affected versions
OTP 28.2
Additional context
I noticed this while searching a way to encode and decode ASN1 GeneralizedTime using the public_key API. I am posting this issue because it looks to me like a possible bug.