Skip to content

Commit 086bf9d

Browse files
committed
public_key: Add missing translation
1 parent 8bb8008 commit 086bf9d

File tree

2 files changed

+18
-0
lines changed

2 files changed

+18
-0
lines changed

lib/public_key/src/public_key.erl

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -578,6 +578,8 @@ der_decode('Dss-Sig-Value', Der) ->
578578
error:{badmatch, {error, _}} = Error ->
579579
erlang:error(Error)
580580
end;
581+
der_decode('ExtensionRequest', Value) ->
582+
der_decode('ExtensionReq', Value);
581583
der_decode('AttributeTypeAndValue', Der) ->
582584
{ok, Decoded} = 'PKIX1Explicit-2009':decode('SingleAttribute', Der),
583585
pubkey_cert_records:transform(Decoded, decode);
@@ -624,6 +626,7 @@ get_asn1_module('SubjectPublicKeyInfo') -> 'PKIX1Explicit-2009';
624626
get_asn1_module('CertificateList') -> 'PKIX1Explicit-2009';
625627
get_asn1_module('TBSCertList') -> 'PKIX1Explicit-2009';
626628
get_asn1_module('Name') -> 'PKIX1Explicit-2009';
629+
get_asn1_module('X520CommonName') -> 'PKIX1Explicit-2009';
627630
get_asn1_module('Validity') -> 'PKIX1Explicit-2009';
628631
get_asn1_module('RSAPublicKey') -> 'PKIXAlgs-2009';
629632
get_asn1_module('DSA-Params') -> 'PKIXAlgs-2009';
@@ -875,6 +878,8 @@ der_encode('AttributeTypeAndValue', Value) ->
875878
Term = pubkey_cert_records:transform(Value, encode),
876879
{ok, Encoded} = 'PKIX1Explicit-2009':encode('SingleAttribute', Term),
877880
Encoded;
881+
der_encode('ExtensionRequest', Value) ->
882+
der_encode('ExtensionReq', Value);
878883
der_encode(Asn1ExtType, Value) when Asn1ExtType == 'SubjectAltName';
879884
Asn1ExtType == 'IssuerAltName';
880885
Asn1ExtType == 'ExtKeyUsage';

lib/public_key/test/public_key_SUITE.erl

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -107,6 +107,8 @@
107107
pkix_ext_key_usage/1,
108108
pkix_ext_key_usage_any/0,
109109
pkix_ext_key_usage_any/1,
110+
pkix_extensionreq/0,
111+
pkix_extensionreq/1,
110112
pkix_path_validation_bad_date/0,
111113
pkix_path_validation_bad_date/1,
112114
pkix_verify_hostname_cn/1,
@@ -201,6 +203,7 @@ all() ->
201203
pkix_test_data_all_default,
202204
pkix_test_data,
203205
pkix_is_issuer,
206+
pkix_extensionreq,
204207
short_cert_issuer_hash,
205208
short_crl_issuer_hash,
206209
cacerts_load,
@@ -1569,6 +1572,16 @@ pkix_is_issuer(Config) when is_list(Config) ->
15691572
[{'AttributeTypeAndValue',{2,5,4,3},{utf8String,<<"INTERMEDIATE">>}}]]},
15701573
true = pubkey_cert:is_issuer(Upper, Lower).
15711574

1575+
%%--------------------------------------------------------------------
1576+
pkix_extensionreq() ->
1577+
[{doc, "Basic test that asn1 for EnrollmentMessageSyntax is supported"}].
1578+
1579+
pkix_extensionreq(Config) when is_list(Config) ->
1580+
Expected = <<48,0>>,
1581+
Expected = public_key:der_encode('ExtensionReq', []),
1582+
%% Backwards compatibility
1583+
Expected = public_key:der_encode('ExtensionRequest', []).
1584+
15721585
%%--------------------------------------------------------------------
15731586
short_cert_issuer_hash() ->
15741587
[{doc, "Test OpenSSL-style hash for certificate issuer"}].

0 commit comments

Comments
 (0)