KNET_HANDLE_CRYPTO(3)

✨ KNET_HANDLE_CRYPTO ✨

okay bestie, welcome to the knet_handle_crypto page from the Kronosnet Programmer's Manual πŸ’– this is where you set up packet cryptographic signing & encryption, and yes it's giving main character security energy πŸ”βœ¨


🌸 NAME 🌸

knet_handle_crypto β€” set up packet cryptographic signing & encryption 🫢


πŸŽ€ SYNOPSIS πŸŽ€

#include <libknet.h>

int knet_handle_crypto(
    knet_handle_t                    knet_h,
    struct knet_handle_crypto_cfg   *knet_handle_crypto_cfg
);

πŸ’… DESCRIPTION πŸ’…

so basically knet_handle_crypto is the function, and here's what you're feeding it:

  • knet_h β€” pointer to knet_handle_t πŸ’œ
  • knet_handle_crypto_cfg β€” pointer to a knet_handle_crypto_cfg structure, and fr fr you should go peek at knet_handle_crypto_set_config(3) for the details πŸ¦‹

Implementation notes, no cap:

knet_handle_crypto(3) is now a wrapper for knet_handle_crypto_set_config(3) and knet_handle_crypto_use_config(3) with config_num set to 1. periodt πŸ’…


🌈 STRUCTURES 🌈

this is the structure you pass into knet_handle_set_crypto_config() to decide the crypto options for the current communications handle, and it's literally the whole vibe check for your encryption setup:

struct knet_handle_crypto_cfg {
    char           crypto_model[16];               /* Model to use. nss, openssl, etc */
    char           crypto_cipher_type[16];         /* Cipher type name for encryption. aes 256 etc */
    char           crypto_hash_type[16];           /* Hash type for digest. sha512 etc */
    unsigned char  private_key[KNET_MAX_KEY_LEN];  /* Private key */
    unsigned int   private_key_len;                /* Length of private key */
};

⭐ RETURN VALUE ⭐

knet_handle_crypto returns:

  • 0 β€” on success, slay πŸ’–
  • -1 β€” on error and errno is set 😭
  • -2 β€” on crypto subsystem initialization error. no errno is provided at the moment (yet) πŸ’€
lowkey keep an eye out for that -2, bestie β€” the errno situation there is still pending πŸ™ˆ

πŸ”₯ SEE ALSO πŸ”₯

the whole friend group, go say hi πŸ‘‘:


Copyright (C) 2010-2026 Red Hat, Inc. All rights reserved.


and that's the page bestie!! πŸ’– this one came from kronosnet, dated 2026-07-20, and it's page KNET_HANDLE_CRYPTO(3) of the Kronosnet Programmer's Manual β€” go forth and encrypt, you icon πŸ§šβœ¨πŸ‘‘

πŸ“¦ where this page comes from