Debian Codegraph @

doc/functions/gnutls_hpke_decap

raw
1
2
3
4 @deftypefun {int} {gnutls_hpke_decap} (gnutls_hpke_context_t @var{ctx}, const gnutls_datum_t * @var{info}, const gnutls_datum_t * @var{enc}, const gnutls_privkey_t @var{receiver_privkey}, const gnutls_pubkey_t @var{sender_pubkey}, const gnutls_datum_t * @var{psk}, const gnutls_datum_t * @var{psk_id})
5 @var{ctx}: The HPKE context to use for decapsulation.
6
7 @var{info}: The application-specific information that was included in the key schedule (optional).
8
9 @var{enc}: A pointer to a gnutls_datum_t structure containing the encapsulated key received from the sender.
10
11 @var{receiver_privkey}: The receiver's private key to use for decapsulation.
12
13 @var{sender_pubkey}: The sender's public key for AuthDecap operation (optional).
14
15 @var{psk}: The pre-shared key (optional).
16
17 @var{psk_id}: The pre-shared key identifier (optional).
18
19 This function performs the decapsulation operation of HPKE. It
20 takes the encapsulated key ( @code{enc} ) received from the sender and uses
21 it along with the receiver's private key to derive the shared
22 secret. It then uses this shared secret along with any provided
23 application-specific information ( @code{info} ) to set up the necessary
24 keys and nonces in the HPKE context for subsequent sealing and
25 opening operations.
26
27 This function must be used once per HPKE context and before any
28 calls to @code{gnutls_hpke_open()} .
29
30 @code{enc} should be the same encapsulated key that was generated by
31 @code{gnutls_hpke_encap()} on the sender's side.
32
33 @code{receiver_privkey} must be a valid private key that is compatible
34 with the KEM algorithm specified in the HPKE context and that
35 corresponds to the receiver's public key used during encapsulation.
36
37 For @code{GNUTLS_HPKE_MODE_AUTH} or @code{GNUTLS_HPKE_MODE_AUTH_PSK} ,
38 @code{sender_pubkey} must be a valid public key that can be used for
39 authentication. For @code{GNUTLS_HPKE_MODE_PSK} or
40 @code{GNUTLS_HPKE_MODE_AUTH_PSK} , a pre-shared key ( @code{psk} ) and its
41 identifier ( @code{psk_id} ) must be supplied.
42
43 @strong{Returns:} 0 on success, or a negative error code on failure
44
45 @strong{Since:} 3.8.13
46 @end deftypefun