gnutls_hpke_decap(3) — Linux manual page

NAME | SYNOPSIS | ARGUMENTS | DESCRIPTION | RETURNS | SINCE | REPORTING BUGS | COPYRIGHT | SEE ALSO | COLOPHON

gnutls_hpke_decap(3)              gnutls             gnutls_hpke_decap(3)

NAME         top

       gnutls_hpke_decap - API function

SYNOPSIS         top

       #include <gnutls/hpke.h>

       int gnutls_hpke_decap(gnutls_hpke_context_t ctx, const
       gnutls_datum_t * info, const gnutls_datum_t * enc, const
       gnutls_privkey_t receiver_privkey, const gnutls_pubkey_t
       sender_pubkey, const gnutls_datum_t * psk, const gnutls_datum_t *
       psk_id);

ARGUMENTS         top

       gnutls_hpke_context_t ctx
                   The HPKE context to use for decapsulation.

       const gnutls_datum_t * info
                   The application-specific information that was included
                   in the key schedule (optional).

       const gnutls_datum_t * enc
                   A pointer to a gnutls_datum_t structure containing the
                   encapsulated key received from the sender.

       const gnutls_privkey_t receiver_privkey
                   The receiver's private key to use for decapsulation.

       const gnutls_pubkey_t sender_pubkey
                   The sender's public key for AuthDecap operation
                   (optional).

       const gnutls_datum_t * psk
                   The pre-shared key (optional).

       const gnutls_datum_t * psk_id
                   The pre-shared key identifier (optional).

DESCRIPTION         top

       This function performs the decapsulation operation of HPKE. It
       takes the encapsulated key ( enc ) received from the sender and
       uses it along with the receiver's private key to derive the shared
       secret. It then uses this shared secret along with any provided
       application-specific information ( info ) to set up the necessary
       keys and nonces in the HPKE context for subsequent sealing and
       opening operations.

       This function must be used once per HPKE context and before any
       calls to gnutls_hpke_open().

        enc should be the same encapsulated key that was generated by
       gnutls_hpke_encap() on the sender's side.

        receiver_privkey must be a valid private key that is compatible
       with the KEM algorithm specified in the HPKE context and that
       corresponds to the receiver's public key used during
       encapsulation.

       For GNUTLS_HPKE_MODE_AUTH or GNUTLS_HPKE_MODE_AUTH_PSK,
        sender_pubkey must be a valid public key that can be used for
       authentication. For GNUTLS_HPKE_MODE_PSK or
       GNUTLS_HPKE_MODE_AUTH_PSK, a pre-shared key ( psk ) and its
       identifier ( psk_id ) must be supplied.

RETURNS         top

       0 on success, or a negative error code on failure

SINCE         top

       3.8.13

REPORTING BUGS         top

       Report bugs to <bugs@gnutls.org>.
       Home page: https://www.gnutls.org

COPYRIGHT         top

       Copyright © 2001-2023 Free Software Foundation, Inc., and others.
       Copying and distribution of this file, with or without
       modification, are permitted in any medium without royalty provided
       the copyright notice and this notice are preserved.

SEE ALSO         top

       The full documentation for gnutls is maintained as a Texinfo
       manual.  If the /usr/share/doc/gnutls/ directory does not contain
       the HTML form visit

       https://www.gnutls.org/manual/

COLOPHON         top

       This page is part of the GnuTLS (GnuTLS Transport Layer Security
       Library) project.  Information about the project can be found at
       ⟨http://www.gnutls.org/⟩.  If you have a bug report for this
       manual page, send it to bugs@gnutls.org.  This page was obtained
       from the tarball fetched from
       ⟨https://www.gnupg.org/ftp/gcrypt/gnutls/⟩ on 2026-05-24.  If you
       discover any rendering problems in this HTML version of the page,
       or you believe there is a better or more up-to-date source for the
       page, or you have corrections or improvements to the information
       in this COLOPHON (which is not part of the original manual page),
       send a mail to man-pages@man7.org

gnutls                            3.8.13             gnutls_hpke_decap(3)