mbedtls_pk_copy_public_from_psa() function
Create a PK context for the public key of a PSA key. The key must be an RSA or ECC key. It can be either a public key or a key pair, and only the public key is copied. The resulting PK object will be a transparent type: - #MBEDTLS_PK_RSA for RSA keys or - #MBEDTLS_PK_ECKEY for EC keys. Once this functions returns the PK object will be completely independent from the original PSA key that it was generated from. Calling mbedtls_pk_verify() or mbedtls_pk_encrypt() on the resulting PK context will perform the corresponding algorithm for that PK context type. For an RSA key, the output PK context will allow both encrypt and verify regardless of the original key's policy. The original key's policy determines the output key's padding mode: PCKS1 v2.1 is set if the PSA key policy is OAEP or PSS, otherwise PKCS1 v1.5 is set.
Arguments
key_id
The key identifier of the key stored in PSA.
pk
The PK context that will be filled. It must be initialized, but not set up.
Return value
0 on success. MBEDTLS_ERR_PK_BAD_INPUT_DATA in case the provided input parameters are not correct.
mbedtls_pk_copy_public_from_psa() calls 1 function:
![]()
mbedtls_pk_copy_public_from_psa()
mbedtls_pk_copy_public_from_psa():
![]()
mbedtls_pk_copy_public_from_psa()