X509_LOAD_HTTP(3SSL)

✨ X509_LOAD_HTTP ✨

okay bestie, gather round, because today we're talking about X509_load_http, X509_http_nbio, X509_CRL_load_http and X509_CRL_http_nbio β€” literally the certificate and CRL loading functions from the OpenSSL 3SSL era. yes, the whole squad. this is the page for all four of them. πŸŽ€


🌸 SYNOPSIS 🌸

first things first, you gotta pull in the header:

#include <openssl/x509.h>

then the two main-character functions:

X509 *X509_load_http(const char *url, BIO *bio, BIO *rbio, int timeout);
X509_CRL *X509_CRL_load_http(const char *url, BIO *bio, BIO *rbio, int timeout);

and then… the deprecated ones πŸ’€ these macros have been deprecated since OpenSSL 3.0, and you can hide them entirely by defining OPENSSL_API_COMPAT with a suitable version value β€” go check openssl_user_macros(7) for the deets:

#define X509_http_nbio(rctx, pcert)
#define X509_CRL_http_nbio(rctx, pcrl)

πŸ’– DESCRIPTION πŸ’–

so what do these do? X509_load_http() and X509_CRL_load_http() load a certificate or a CRL, respectively, in ASN.1 format using HTTP from the given url. that's it, that's the vibe. 🌈

and because nobody wants to get absolutely bodied by a giant response, there's a cap: the maximum size of the HTTP response is 100 kB for certificates and 32 MB for CRLs, and it is hard coded in the functions. no, you can't change it. periodt. πŸ’…

now, the bio/rbio situation, bestie, listen up:

  • if bio is given and rbio is NULL, then that BIO is used instead of an internal one for connecting, writing the request, and reading the response. πŸ™ˆ
  • if both bio and rbio are given (which may be memory BIOs, for instance), then no explicit connection is attempted β€” bio is used for writing the request, and rbio for reading the response. iconic duo behavior. ✨

and the timeout parameter? absolute vibe check:

  • if timeout is > 0, that's the maximum number of seconds to wait until the transfer is complete ⏳
  • a value of 0 enables waiting indefinitely β€” main character energy, no rush
  • while a value < 0 immediately leads to a timeout condition 😭 like instantly, no hesitation

lastly, X509_http_nbio() and X509_CRL_http_nbio() are macros for backward compatibility that have the same effect as the functions above β€” but with an infinite timeout and without the possibility to specify custom BIOs. so, simpler, but less to work with. πŸ’œ


πŸ¦‹ RETURN VALUES πŸ¦‹

on success the function yield the loaded value, else NULL. πŸ’€ and the error conditions include connection/transfer timeout, parse errors, etc. so yeah, if you get NULL, something went sideways.


⭐ SEE ALSO ⭐


πŸ‘‘ HISTORY πŸ‘‘

  • X509_load_http() and X509_CRL_load_http() were added in OpenSSL 3.0.
  • X509_http_nbio() and X509_CRL_http_nbio() were deprecated in OpenSSL 3.0.

so the second pair is giving legacy, iykyk. 🧚


Copyright 2019-2021 The OpenSSL Project Authors. All Rights Reserved.

Licensed under the Apache License 2.0 (the "License"). You may not use this file except in compliance with the License. You can obtain a copy in the file LICENSE in the source distribution or at <https://www.openssl.org/source/license.html>.

fr fr, read the license bestie, it's not a suggestion πŸ’…

and that's the whole page, no cap 🫢 this was OpenSSL 4.0.3, dated 2026-09-29 β€” go slay some certificates, you absolute icon πŸŽ€βœ¨

πŸ“¦ where this page comes from