Debian Codegraph @

doc/functions/gnutls_hpke_open

raw
1
2
3
4
5 @deftypefun {int} {gnutls_hpke_open} (gnutls_hpke_context_t @var{ctx}, const gnutls_datum_t * @var{aad}, const gnutls_datum_t * @var{ciphertext}, gnutls_datum_t * @var{plaintext})
6 @var{ctx}: The HPKE context to use for opening.
7
8 @var{aad}: The associated data (AAD) that was authenticated during sealing.
9
10 @var{ciphertext}: The ciphertext received from the sender.
11
12 @var{plaintext}: A pointer to a gnutls_datum_t structure where the resulting plaintext will be stored.
13
14 This function performs the opening operation of HPKE. It takes the
15 ciphertext received from the sender and uses the keys and nonces
16 set up in the HPKE context (after decapsulation) to decrypt the
17 ciphertext and verify the authentication tag. If the decryption and
18 authentication are successful, the resulting plaintext is stored in
19 @code{plaintext} . If the decryption or authentication fails, the function
20 securely erases any allocated plaintext and returns an error code.
21
22 This function can be used multiple times with the same HPKE
23 context, but the decapsulation function (@code{gnutls_hpke_decap()} ) must
24 be called once before the first call to this function.
25
26 @code{aad} should be the same AAD that was provided to @code{gnutls_hpke_seal()}
27 on the sender's side.
28
29 @code{ciphertext} should be the same ciphertext that was generated by
30 @code{gnutls_hpke_seal()} on the sender's side.
31
32 The function will allocate memory for the @code{plaintext} , and the
33 caller is responsible for freeing this memory using @code{gnutls_free()}
34 when it is no longer needed.
35
36 @strong{Returns:} 0 on success, or a negative error code on failure
37
38 @strong{Since:} 3.8.13
39 @end deftypefun