nRF Connect SDK API 3.3.99
Loading...
Searching...
No Matches

◆ cracen_aead_encrypt()

psa_status_t cracen_aead_encrypt ( const psa_key_attributes_t * attributes,
const uint8_t * key_buffer,
size_t key_buffer_size,
psa_algorithm_t alg,
const uint8_t * nonce,
size_t nonce_length,
const uint8_t * additional_data,
size_t additional_data_length,
const uint8_t * plaintext,
size_t plaintext_length,
uint8_t * ciphertext,
size_t ciphertext_size,
size_t * ciphertext_length )

#include <subsys/nrf_security/src/drivers/cracen/cracenpsa/include/cracen_psa_aead.h>

Encrypt and authenticate a message using AEAD.

Parameters
[in]attributesKey attributes.
[in]key_bufferKey material buffer.
[in]key_buffer_sizeSize of the key buffer in bytes.
[in]algAEAD algorithm.
[in]nonceNonce or IV.
[in]nonce_lengthLength of the nonce in bytes.
[in]additional_dataAdditional Authenticated Data (AAD).
[in]additional_data_lengthLength of Additional Authenticated Data (AAD) in bytes.
[in]plaintextPlaintext to encrypt.
[in]plaintext_lengthLength of the plaintext in bytes.
[out]ciphertextBuffer to store the ciphertext and tag.
[in]ciphertext_sizeSize of the ciphertext buffer in bytes.
[out]ciphertext_lengthLength of the generated ciphertext in bytes.
Return values
PSA_SUCCESSThe operation completed successfully.
PSA_ERROR_INVALID_HANDLEThe key handle is invalid.
PSA_ERROR_NOT_SUPPORTEDThe algorithm is not supported.
PSA_ERROR_BUFFER_TOO_SMALLThe ciphertext buffer is too small.