psa_asymmetric_decrypt() function
Decrypt a short message with a private key. - For #PSA_ALG_RSA_PKCS1V15_CRYPT, no salt is supported.
Arguments
key
Identifier of the key to use for the operation. It must be an asymmetric key pair. It must allow the usage #PSA_KEY_USAGE_DECRYPT.
alg
An asymmetric encryption algorithm that is compatible with the type of \p key.
input
The message to decrypt.
input_length
Size of the \p input buffer in bytes.
salt
A salt or label, if supported by the encryption algorithm. If the algorithm does not support a salt, pass \c NULL. If the algorithm supports an optional salt and you do not want to pass a salt, pass \c NULL.
salt_length
Size of the \p salt buffer in bytes. If \p salt is \c NULL, pass 0.
output
Buffer where the decrypted message is to be written.
output_size
Size of the \c output buffer in bytes.
output_length
On success, the number of bytes that make up the returned output.
Return value
#PSA_SUCCESS \emptydescription #PSA_ERROR_INVALID_HANDLE \emptydescription #PSA_ERROR_NOT_PERMITTED \emptydescription #PSA_ERROR_BUFFER_TOO_SMALL The size of the \p output buffer is too small. You can determine a sufficient buffer size by calling #PSA_ASYMMETRIC_DECRYPT_OUTPUT_SIZE(\c key_type, \c key_bits, \p alg) where \c key_type and \c key_bits are the type and bit-size respectively of \p key. #PSA_ERROR_NOT_SUPPORTED \emptydescription #PSA_ERROR_INVALID_ARGUMENT \emptydescription #PSA_ERROR_INSUFFICIENT_MEMORY \emptydescription #PSA_ERROR_COMMUNICATION_FAILURE \emptydescription #PSA_ERROR_HARDWARE_FAILURE \emptydescription #PSA_ERROR_CORRUPTION_DETECTED \emptydescription #PSA_ERROR_STORAGE_FAILURE \emptydescription #PSA_ERROR_INSUFFICIENT_ENTROPY \emptydescription #PSA_ERROR_INVALID_PADDING \emptydescription #PSA_ERROR_BAD_STATE The library has not been previously initialized by psa_crypto_init(). It is implementation-dependent whether a failure to initialize results in this error code.
psa_asymmetric_decrypt() calls 7 functions:
![]()
psa_asymmetric_decrypt()
psa_asymmetric_decrypt() reads 7 variables:
![]()
psa_asymmetric_decrypt()