X509_REQ_PRINT_EX(3)

πŸ“¦ version 4.4.0, in alpine 3.24, arch rolling

πŸ’– NAME πŸ’–

okay so this is the X509_REQ_PRINT_EX(3) page from the libcrypto Library Functions Manual, and it’s about the bestie trio X509_REQ_print_ex, X509_REQ_print, and X509_REQ_print_fp β€” they pretty-print a PKCS#10 certification request. That’s the whole assignment: take a cert request and make it human-readable. ✨

πŸŽ€ SYNOPSIS πŸŽ€

the vibe check:

library β€œlibcrypto” #include <openssl/x509.h>

int
X509_REQ_print_ex(BIO *bio, X509_REQ *req, unsigned long nameflags,
    unsigned long skipflags);

int
X509_REQ_print(BIO *bio, X509_REQ *req);

int
X509_REQ_print_fp(FILE *fp, X509_REQ *req);

🌸 DESCRIPTION 🌸

X509_REQ_print_ex() prints information contained in req to bio in human-readable form. It’s giving β€œmake the PKCS#10 request legible, bestie.” πŸ’… Printing is aborted as soon as any operation fails, with the exception that failures while attempting to decode or print the public key are not considered as errors. So key decode/print fails get a little grace period; everything else? no cap, it stops. 😭

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. Obsessed with this little flag map. πŸ—ΊοΈ

The nameflags argument modifies the format for printing X.501 Name objects contained in req. 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_REQ_print() is a wrapper function setting the nameflags to XN_FLAG_COMPAT and the skipflags to X509_FLAG_COMPAT. X509_REQ_print_fp() is similar to X509_REQ_print() except that it prints to fp. main character wrapper energy. 😌

πŸ“ RETURN VALUES πŸ“

These functions return 1 if all requested information was successfully printed, even if failures occurred while attempting to decode or print the public key, or 0 if any operation fails. So it’s literally 1 = we ate, 0 = something failed. And remember: public-key decode/print failures do not flip that success 1 to 0. 🫑

πŸ¦‹ SEE ALSO πŸ¦‹

πŸ‘‘ HISTORY πŸ‘‘

X509_REQ_print() first appeared in SSLeay 0.4.4 and X509_REQ_print_fp() in SSLeay 0.6.0. These functions have been available since OpenBSD 2.4.

X509_REQ_print_ex() first appeared in OpenSSL 0.9.7 and has been available since OpenBSD 3.2. Ancestry dot com who? πŸ’…

πŸ’€ BUGS πŸ’€

warning bestie: Some printing failures are silently ignored while printing extensions, which may result in incomplete data being printed. So yeah: extension printing can ghost you, and the output might be incomplete. Not iconic, but documented. 😭

mwah πŸ’– β€” this page came from Debian, dated June 8, 2025, and yes bestie, it’s X509_REQ_PRINT_EX(3). bye! πŸŽ€

πŸ“¦ where this page comes from