Closed samuel40791765 closed 1 month ago
All modified and coverable lines are covered by tests :white_check_mark:
Project coverage is 78.55%. Comparing base (
c664abe
) to head (9a12688
).
:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Have feedback on the report? Share it here.
Description of changes:
There exists a rarer OID of RSA public keys which comes from the ITU-T version of X.509 (links below). Links:
OpenSSL accepts the
sign_nid
andpkey_nid
for this draft.NID_md5WithRSA
NID_sha1WithRSA
NID_rsa
We can parse both
sign_nid
s correctly. But we lack the logic to interpretNID_rsa
in a certificate or map the parsedsign_nid
s to any RSA implementation. OpenSSL maps the corresponding nids from the same draft, which meansNID_md5WithRSA
andNID_sha1WithRSA
are mapped toNID_rsa
and an additionalEVP_PKEY_RSA2
is used to representNID_rsa
. The additionalEVP_PKEY
type introduces additional complexities however and the underlying functionality inEVP_PKEY_RSA2
is identical to it's more commonEVP_PKEY_RSA
counterpart.We've been burned by multiple OpenSSL cert parsing differences in the past, so we should have logic to understand certs that have
NID_rsa
. We don't want to duplicate all the function pointers forEVP_PKEY_RSA2
however. Since the underlying RSA functions pointers are the same, I think it should be OK for us toNID_md5WithRSA
andNID_sha1WithRSA
to our RSA implementation (NID_rsa_encryption
).NID_rsa
toEVP_PKEY_RSA
when parsing certificates.Unfortunately, there's some stricter parsing in
rsa_pub_decode
that I've had to remove since it doesn't apply to both RFCs for RSA public keys. This is aligning with OpenSSL, which happens to ignore both of the early parameters specified in either.Call-outs:
Although we have
EVP_PKEY_RSA2
and we could map the logic for that toEVP_PKEY_RSA
inEVP_PKEY_type
, I've intentionally left that out for now. We still want to discourage people from using this form, we just need to understand how to parse certificates that have it.Relevant historic commits:
NID_rsa
: https://github.com/aws/aws-lc/commit/f6094e05efd294e15fe7f2e430f391445ee546bbTesting:
WIP
By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license and the ISC license.