
ngtcp2_conn_install_tx_key
==========================

Synopsis
--------

*#include <ngtcp2/ngtcp2.h>*

.. function:: int ngtcp2_conn_install_tx_key( ngtcp2_conn *conn, const uint8_t *secret, size_t secretlen, const ngtcp2_crypto_aead_ctx *aead_ctx, const uint8_t *iv, size_t ivlen, const ngtcp2_crypto_cipher_ctx *hp_ctx)

    
    `ngtcp2_conn_install_tx_key` installs packet protection keying
    materials for encrypting 1-RTT packets.  *secret* of length
    *secretlen* is the encryption secret which is used to derive keying
    materials passed to this function.  *aead_ctx* is AEAD cipher
    context object which must be initialized with an encryption key.
    *iv* is IV of length *ivlen*.  *hp_ctx* is a packet header
    protection cipher context object.
    
    *ivlen* must be the minimum length of AEAD nonce, or 8 bytes if
    that is larger.
    
    If this function succeeds, *conn* takes ownership of *aead_ctx* and
    *hp_ctx*.  :member:`ngtcp2_callbacks.delete_crypto_aead_ctx` and
    :member:`ngtcp2_callbacks.delete_crypto_cipher_ctx` will be called
    to delete these objects when they are no longer used.  If this
    function fails, the caller is responsible to delete them.
    
    This function returns 0 if it succeeds, or one of the following
    negative error codes:
    
    :macro:`NGTCP2_ERR_NOMEM`
        Out of memory.
