OpenBSD manual page server

Manual Page Search Parameters

X509V3_EXT_PRINT(3) Library Functions Manual X509V3_EXT_PRINT(3)

X509V3_EXT_print, X509V3_EXT_print_fppretty-print an X.509 extension

#include <openssl/x509v3.h>

int
X509V3_EXT_print(BIO *bio, X509_EXTENSION *ext, unsigned long flags, int indent);

int
X509V3_EXT_print_fp(FILE *file, X509_EXTENSION *ext, int flags, int indent);

() and () decode ext and print the data contained in it to the bio or file, respectively, in a human-readable format with a left margin of indent space characters. The details of both the decoding and the printing depend on the type of ext.

For most extension types, the decoding is done in the same way as it would be done by the appropriate public API function, for example:

d2i_AUTHORITY_KEYID(3)
d2i_CERTIFICATEPOLICIES(3)
d2i_ASN1_INTEGER(3)
d2i_ASN1_ENUMERATED(3)
d2i_ASN1_OBJECT(3)
d2i_OCSP_CRLID(3)
d2i_ASN1_NULL(3)
non-public function built into the library
d2i_ASN1_GENERALIZEDTIME(3)
d2i_ASN1_BIT_STRING(3)
d2i_GENERAL_NAMES(3)
d2i_ASN1_OCTET_STRING(3)

For some types, the printing is performed by a dedicated non-public function built into the library. For some other types, the printing function is a public API function, for example:

i2s_ASN1_INTEGER(3)
i2s_ASN1_ENUMERATED_TABLE(3)
i2s_ASN1_INTEGER(3)
i2a_ASN1_OBJECT(3)
ASN1_GENERALIZEDTIME_print(3)
i2a_ASN1_STRING(3)
i2s_ASN1_INTEGER(3)
ASN1_GENERALIZEDTIME_print(3)
i2v_ASN1_BIT_STRING(3)
i2s_ASN1_OCTET_STRING(3)

Some of the public printing functions are not documented yet.

If ext is of an unknown extension type or if decoding fails while using the decoding function for the relevant type, the action taken depends on the flags argument:

X509V3_EXT_print() and X509V3_EXT_print_fp() return 0 if failure was both detected and considered relevant. Otherwise, 1 is returned, and in general the user cannot tell whether failure simply went undetected, whether the function detected failure but regarded it as irrelevant, or whether printing did indeed succeed.

BIO_new(3), X509_EXTENSION_new(3), X509_get0_extensions(3), X509_get_ext(3), X509V3_extensions_print(3)

These functions first appeared in OpenSSL 0.9.2 and have been available since OpenBSD 2.6.

These functions lack error handling throughout. When a write operation fails, they will usually ignore the fact that information was omitted from the output and report success to the caller anyway.

December 28, 2024 OpenBSD-current