Hey All,I am trying to generate ECDSA public-private key pair for self-signed certificate, and came across these examples
In
gen_key.c, "mbedtls_ecp_gen_key()" is used
In
ecdsa.c, "mbedtls_ecdsa_genkey()" is used.
My questions are:
- Which function should be used? (It seems
mbedtls_ecdsa_genkey() is just a wrapper of
mbedtls_ecp_gen_key()?)
- If using mbedtls_ecdsa_genkey(), what are the steps to write the public key into PEM format? (My understanding is that I define a mbedtls_pk_context, and convert its address into mbedtls_ecdsa_context *, and pass the pointer into
mbedtls_ecdsa_genkey, and then call mbedtls_ecdsa_genkey(), is this correct?)
Thanks,
Tom