Skip to content

mbedtls: RSA PKCS8 import slices wrong DER object#598

Open
jedisct1 wants to merge 1 commit intoh2o:masterfrom
dip-proto:rsa-pkcs8-import-slices-wrong-der-object
Open

mbedtls: RSA PKCS8 import slices wrong DER object#598
jedisct1 wants to merge 1 commit intoh2o:masterfrom
dip-proto:rsa-pkcs8-import-slices-wrong-der-object

Conversation

@jedisct1
Copy link
Copy Markdown
Contributor

ptls_mbedtls_load_private_key unwraps PKCS#8 BEGIN PRIVATE KEY material with test_parse_private_key_field, yielding key_index and key_length for the inner private-key OCTET STRING payload.

In the RSA branch, the code then switches back to the outer PKCS#8 buffer and length before deriving RSA attributes and calling psa_import_key.

As a result, RSA-specific parsing receives a PrivateKeyInfo object instead of the required inner RSAPrivateKey DER object.

`ptls_mbedtls_load_private_key` unwraps PKCS#8 `BEGIN PRIVATE KEY`
material with `test_parse_private_key_field`, yielding `key_index`
and `key_length` for the inner private-key OCTET STRING payload.

In the RSA branch, the code then switches back to the outer PKCS#8
buffer and length before deriving RSA attributes and calling
`psa_import_key`.

As a result, RSA-specific parsing receives a `PrivateKeyInfo` object
instead of the required inner `RSAPrivateKey` DER object.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant