mbedtls_ecp_read_key() function
This function reads an elliptic curve private key.
Arguments
grp_id
The ECP group identifier.
buf
The buffer containing the binary representation of the key. (Big endian integer for Weierstrass curves, byte string for Montgomery curves.)
buflen
The length of the buffer in bytes.
Return value
\c 0 on success. #MBEDTLS_ERR_ECP_INVALID_KEY error if the key is invalid. #MBEDTLS_ERR_MPI_ALLOC_FAILED if memory allocation failed. #MBEDTLS_ERR_ECP_FEATURE_UNAVAILABLE if the operation for the group is not implemented. Another negative error code on different kinds of failure.
Notes
This function does not set the public key in the key pair object. Without a public key, the key pair object cannot be used with operations that require the public key. Call mbedtls_ecp_keypair_calc_public() to set the public key from the private key. Alternatively, you can call mbedtls_ecp_set_public_key() to set the public key part, and then optionally mbedtls_ecp_check_pub_priv() to check that the private and public parts are consistent. If a public key has already been set in the key pair object, this function does not check that it is consistent with the private key. Call mbedtls_ecp_check_pub_priv() after setting both the public key and the private key to make that check.
![]()
mbedtls_ecp_read_key(ecp->grp.id,
mbedtls_ecp_read_key() is called by 2 functions and calls 7 functions:
![]()
mbedtls_ecp_read_key()
mbedtls_ecp_read_key() reads 4 variables:
![]()
mbedtls_ecp_read_key()