Mbed forum

Analogous function to mbedtls_pk_parse_key (write an encrypted string)

(Subhan Waizi) #1

So following function parses an (un)encrypted DER-encoded private key and fills the pk_context accordingly:

int mbedtls_pk_parse_key( mbedtls_pk_context *pk,
const unsigned char *key, size_t keylen,
const unsigned char *pwd, size_t pwdlen )

Does mbedtls provide a function that works analogously to this one … meaning that it has a pk_context and can store it (encrypted) to a buffer. I’ve only seen mbedtls_pk_write_key_pem, which however does not take encryption into account.

(Ron Eldor) #2

@TrinityTonic
Unfortunately, Mbed TLS does not have an API for writing encrypted key, as it wasn’t part of our original target.
If you believe this feature is required,you are welcome to make a contribution.
Regards,
Mbed TLS Team member
Ron