X509_PRINT_EX(3)

πŸ“¦ version 4.1.0, in opensuse-leap 16.0

🌸 NAME 🌸

okay so bestie, welcome to the X509_PRINT_EX(3) page from the Library Functions Manual ✨ this one is literally all about pretty-printing an X.509 certificate πŸ’…

  • X509_print_ex, X509_CERT_AUX_print, X509_print_ex_fp, X509_print, X509_print_fp β€” pretty-print an X.509 certificate πŸŽ€

✨ SYNOPSIS ✨

#include <openssl/x509.h>

int
X509_print_ex(BIO *bio, X509 *x, unsigned long nameflags,
    unsigned long skipflags);

int
X509_CERT_AUX_print(BIO *bio, X509_CERT_AUX *aux, int indent);

int
X509_print_ex_fp(FILE *fp, X509 *x, unsigned long nameflags,
    unsigned long skipflags);

int
X509_print(BIO *bio, X509 *x);

int
X509_print_fp(FILE *fp, X509 *x);

πŸ¦‹ DESCRIPTION πŸ¦‹

so X509_print_ex() prints the information contained in x to bio in human-readable form, which is giving β€œmake this certificate make sense to a human” energy πŸ’– Printing is aborted as soon as any operation fails, with the exception that failures while attempting to decode or print the public key, the X.509 version 3 extensions, or non-standard auxiliary data are not considered as errors πŸ‘€

by default, the following blocks of information are printed in the following order. Each block can be skipped by setting the corresponding bit in skipflags, provided in parentheses after each block description 🫢

the nameflags argument modifies the format for printing X.501 Name objects contained in x πŸŽ€ It is passed through to X509_NAME_print_ex(3). If nameflags is X509_FLAG_COMPAT, the indent argument of X509_NAME_print_ex(3) is set to 16 spaces and the traditional SSLeay format is used. Otherwise, if the only bit set in XN_FLAG_SEP_MASK is XN_FLAG_SEP_MULTILINE, indent is set to 12 spaces. Otherwise, indent is set to zero πŸ‘‘

X509_CERT_AUX_print() prints information contained in aux to bio in human-readable form with a left margin of indent spaces. If aux is NULL, it prints nothing πŸ™ˆ

information is printed in the following order:

X509_print_ex_fp() is similar to X509_print_ex() except that it prints to fp πŸ’–

X509_print() and X509_print_fp() are wrapper functions setting the nameflags to XN_FLAG_COMPAT and the skipflags to X509_FLAG_COMPAT ✨


πŸ’œ RETURN VALUES πŸ’œ

X509_print_ex(), X509_print_ex_fp(), X509_print(), and X509_print_fp() return 1 if all requested information was successfully printed, even if failures occurred while attempting to decode or print the public key or X.509 version 3 extensions, or 0 if any other operation failed 😭

X509_CERT_AUX_print() always returns 1 and silently ignores write errors πŸ’€


🌈 SEE ALSO 🌈


🧚 HISTORY 🧚

X509_print() first appeared in SSLeay 0.5.1 and was changed to print to a BIO in SSLeay 0.6.0. X509_print_fp() first appeared in SSLeay 0.6.0. Both functions have been available since OpenBSD 2.4 ⭐

X509_CERT_AUX_print() first appeared in OpenSSL 0.9.5 and has been available since OpenBSD 2.7 🌸

X509_print_ex() and X509_print_ex_fp() first appeared in OpenSSL 0.9.7 and have been available since OpenBSD 3.2 πŸ‘‘


πŸ’… BUGS πŸ’…

If arbitrary data was stored into x using X509_alias_set1(3), these functions may print binary data and even NUL bytes 😭 no cap, that’s the bug note.

and that’s the whole page, bestie 🫢 brought to you by Debian, dated March 9, 2025 β€” iconic, honestly πŸ’–βœ¨

πŸ“¦ where this page comes from