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

◆ cracen_encapsulate()

psa_status_t cracen_encapsulate ( const psa_key_attributes_t * attributes,
const uint8_t * key,
size_t key_length,
psa_algorithm_t alg,
const psa_key_attributes_t * output_attributes,
uint8_t * output_key,
size_t output_key_size,
size_t * output_key_length,
uint8_t * ciphertext,
size_t ciphertext_size,
size_t * ciphertext_length )

#include <cracen_psa_key_encapsulation.h>

Use a public key to generate a new shared secret key and associated ciphertext.

Parameters
[in]attributesKey attributes of the encapsulation (public) key.
[in]keyKey material of the encapsulation key.
[in]key_lengthSize of the encapsulation key in bytes.
[in]algKey encapsulation algorithm.
[in]output_attributesKey attributes of the shared secret key to produce.
[out]output_keyBuffer where the shared secret key is to be written.
[in]output_key_sizeSize of the output key buffer in bytes.
[out]output_key_lengthOn success, the number of bytes that make up the shared secret key.
[out]ciphertextBuffer where the ciphertext is to be written. The peer needs it to decapsulate the same shared secret key.
[in]ciphertext_sizeSize of the ciphertext buffer in bytes.
[out]ciphertext_lengthOn success, the number of bytes that make up the ciphertext.
Return values
PSA_SUCCESSThe operation completed successfully.
PSA_ERROR_NOT_SUPPORTEDThe algorithm or the key type is not supported.
PSA_ERROR_INVALID_ARGUMENTInvalid parameters.
PSA_ERROR_BUFFER_TOO_SMALLThe output buffer is too small.