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

◆ cracen_decapsulate()

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

#include <cracen_psa_key_encapsulation.h>

Use a private key to decapsulate a shared secret key from a ciphertext.

Note
ML-KEM uses implicit rejection: an invalid ciphertext does not fail the operation, it yields a shared secret key that differs from the one the peer encapsulated.
Parameters
[in]attributesKey attributes of the decapsulation (private) key.
[in]keyKey material of the decapsulation key.
[in]key_lengthSize of the decapsulation key in bytes.
[in]algKey encapsulation algorithm.
[in]ciphertextBuffer containing the ciphertext produced by the peer.
[in]ciphertext_lengthSize of the ciphertext in bytes.
[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.
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.