OpenBSD manual page server

Manual Page Search Parameters

X509_PRINT_EX(3) Library Functions Manual X509_PRINT_EX(3)

X509_print_ex, X509_CERT_AUX_print, X509_print_ex_fp, X509_print, X509_print_fppretty-print an X.509 certificate

#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);

() prints information contained in x to bio in human-readable form. 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 generated by X509_NAME_print(3) 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.

() 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:

() is similar to X509_print_ex() except that it prints to fp.

() and () are wrapper functions setting the nameflags to XN_FLAG_COMPAT and the skipflags to X509_FLAG_COMPAT.

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.

BIO_new(3), X509_CERT_AUX_new(3), X509_CRL_print(3), X509_new(3), X509_REQ_print_ex(3)

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.

If arbitrary data was stored into x using X509_alias_set1(3), these functions may print binary data and even NUL bytes.

October 29, 2021 OpenBSD-current