X509_PRINT_EX(3)
πΈ 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 π«Ά
- A pair of lines reading
"Certificate:"and"Data:"containing no information. (X509_FLAG_NO_HEADER) - The certificate version number as defined by the standard, followed in parentheses by the value contained in the version field in hexadecimal notation. See
X509_get_version(3)for details. (X509_FLAG_NO_VERSION) - The serial number of the certificate as returned by
X509_get_serialNumber(3). If it is not-1and converting it tolongsucceeds, it is printed in both decimal and hexadecimal format. If it is-1, too wide to fit inlong, or conversion fails, it is printed byte-by-byte in hexadecimal notation. (X509_FLAG_NO_SERIAL) - The name of the signature algorithm is printed with
X509_signature_print(3). (X509_FLAG_NO_SIGNAME) - The issuer name returned by
X509_get_issuer_name(3)is printed withX509_NAME_print_ex(3). (X509_FLAG_NO_ISSUER) - The validity period from
X509_get_notBefore(3)toX509_get_notAfter(3)is printed usingASN1_TIME_print(3). (X509_FLAG_NO_VALIDITY) - The subject name returned from
X509_get_subject_name(3)is printed withX509_NAME_print_ex(3). (X509_FLAG_NO_SUBJECT) - The public key algorithm is printed with
i2a_ASN1_OBJECT(3), and the public key returned fromX509_get_pubkey(3)withEVP_PKEY_print_public(3). (X509_FLAG_NO_PUBKEY) - All X.509 extensions contained in the certificate are printed with
X509V3_extensions_print(3). (X509_FLAG_NO_EXTENSIONS) - The signature is printed with
X509_signature_print(3). (X509_FLAG_NO_SIGDUMP) - Non-standard auxiliary data associated with the certificate is printed using the function
X509_CERT_AUX_print()documented below. (X509_FLAG_NO_AUX)
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:
- Purposes the certificate is intended to be used for as set with
X509_add1_trust_object(3), each printed withOBJ_obj2txt(3). - Purposes the certificate is explicitly not intended to be used for as set with
X509_add1_reject_object(3), again each printed withOBJ_obj2txt(3). - If
auxcontains data set withX509_alias_set1(3), the raw bytes are printed in unencoded form. - If
auxcontains data set withX509_keyid_set1(3), the bytes are printed in hexadecimal notation with colons in between π
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 intoxusingX509_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
- opensuse-leap 16.0: libressl-devel-doc 4.1.0-bp160.1.1 Β· OpenSSL
- Copyright (c) 2021 Ingo Schwarze <schwarze@openbsd.org>
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms