NE_SSL_CONTEXT_CREAT(3)

πŸ“¦
version 0.37.1 Β· 3 versions
, in epel 10, fedora 43, fedora 44, nixos 26.05, nixpkgs unstable

✨ NAME ✨

okay so bestie, welcome to the neon SSL context management function squad πŸ’– β€” this is the whole group chat: ne_ssl_context_create, ne_ssl_context_trustcert, ne_ssl_context_trustdefca, ne_ssl_context_keypair, ne_ssl_context_set_clicert, ne_ssl_context_set_ccprovide, ne_ssl_context_set_versions, ne_ssl_context_set_verify, ne_ssl_context_set_flag, ne_ssl_context_get_flag, ne_ssl_context_destroy β€” literally all of them are the SSL context management functions. periodt. πŸ‘‘


🌸 SYNOPSIS 🌸

#include <ne_ssl.h>

ne_ssl_context *ne_ssl_context_create(int mode);

void ne_ssl_context_trustcert(ne_ssl_context *ctx,
                              const ne_ssl_certificate *cert);

void ne_ssl_context_trustdefca(ne_ssl_context *ctx);

int ne_ssl_context_keypair(ne_ssl_context *ctx, const char *cert,
                           const char *key);

void ne_ssl_context_set_clicert(ne_ssl_context *ctx,
                                const ne_ssl_client_cert *cc);

void ne_ssl_context_set_ccprovide(ne_ssl_context *ctx,
                                  ne_ssl_ccprovide_fn provider,
                                  void *userdata);

int ne_ssl_context_set_versions(ne_ssl_context *ctx,
                                enum ne_ssl_protocol min,
                                enum ne_ssl_protocol max);

int ne_ssl_context_set_verify(ne_ssl_context *ctx, int required,
                              const char *ca_names,
                              const char *verify_cas);

void ne_ssl_context_set_flag(ne_ssl_context *ctx, int flag, int value);

int ne_ssl_context_get_flag(ne_ssl_context *ctx, int flag);

void ne_ssl_context_destroy(ne_ssl_context *ctx);

πŸ’… DESCRIPTION πŸ’…

ne_ssl_context_create is the moment of creation, the birth of your very own SSL context object πŸ¦‹. The mode parameter should be NE_SSL_CTX_CLIENT if you want a client context, or NE_SSL_CTX_SERVER if you want a server context. pick your fighter.

ne_ssl_context_trustcert β€” for a client context, this one configures the context to trust the certificate cert. like, yes babe, we stan that cert, it's in the trust circle now 🫢.

ne_ssl_context_trustdefca β€” also for a client context, this configures the context to trust the default system certificate authorities. the classics. the originals. the ones that were already famous πŸ’–.

ne_ssl_context_keypair β€” for a server context, this configures the server certificate and private key πŸ”‘. The cert and key parameters are filenames to PEM-encoded certificates. filenames, bestie, not the certs themselves, don't get it twisted.

ne_ssl_context_set_clicert β€” configures a client certificate for a client context πŸŽ€. The client certificate cc must be in the decrypted state β€” no locked-up vibes allowed. Also the certificate object is duplicated internally, so the caller is totally free to destroy it after the function returns. no hard feelings, we made a copy πŸ’….

ne_ssl_context_set_ccprovide β€” registers a callback to provide a client certificate on demand, if the server asks for one πŸ™ˆ. The provider callback gets passed the userdata pointer, an array of acceptable CA distinguished names, and the count of names in that array. so it's giving "we'll see what we have when they ask".

ne_ssl_context_set_versions β€” sets the minimum and maximum SSL/TLS protocol versions allowed for the connection πŸ“ˆπŸ“‰. This must be called before initiating the SSL handshake. like, before. not during. before. no cap.

ne_ssl_context_set_verify β€” for a server context, this configures client certificate verification πŸ‘€. If required is non-zero, a client certificate is required (no cert, no entry, sorry queen). If ca_names is non-NULL, it specifies a filename containing PEM certificates from which CA names are sent in the client certificate request. The verify_cas parameter specifies the CAs used for verification.

ne_ssl_context_set_flag β€” sets a flag for the SSL context 🚩. And ne_ssl_context_get_flag retrieves the current value of a flag. No flags are currently defined. yes really. the flag closet is empty bestie, it's giving minimalist 😭.

ne_ssl_context_destroy β€” destroys an SSL context object and frees all associated resources 🧹✨. it's the goodbye era. everything gets cleaned up.


🌈 RETURN VALUE 🌈

  • ne_ssl_context_create returns an SSL context object, or NULL on error πŸ’€.
  • ne_ssl_context_keypair, ne_ssl_context_set_versions, and ne_ssl_context_set_verify return zero on success, or non-zero on error. zero is the slay number, non-zero is the not-slaying number.
  • ne_ssl_context_get_flag returns the flag value. that's it, that's the tea πŸ’….

πŸ¦‹ HISTORY πŸ¦‹

ne_ssl_context_set_clicert and ne_ssl_context_trustdefca are available in neon 0.37.0 and later ⭐. the newer icons on the block, and honestly? they ate.


πŸ‘‘ SEE ALSO πŸ‘‘

ne_sock_handshake(3) β€” go read that one too bestie, iykyk πŸ’œ


Copyright Β© 2001-2026 Joe Orton


and that's the whole page, fr fr πŸ’– this was the neon API reference energy, brought to you by neon 0.37.1, dated 15 March 2026 β€” mwah, stan, slay, go forth and manage your SSL contexts responsibly 🧚✨
πŸ“¦ where this page comes from