summaryrefslogtreecommitdiff
path: root/src/lib/libcrypto/man/X509V3_EXT_print.3
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--src/lib/libcrypto/man/X509V3_EXT_print.3155
1 files changed, 155 insertions, 0 deletions
diff --git a/src/lib/libcrypto/man/X509V3_EXT_print.3 b/src/lib/libcrypto/man/X509V3_EXT_print.3
new file mode 100644
index 0000000000..d9063e4881
--- /dev/null
+++ b/src/lib/libcrypto/man/X509V3_EXT_print.3
@@ -0,0 +1,155 @@
1.\" $OpenBSD: X509V3_EXT_print.3,v 1.1 2021/07/12 11:47:01 schwarze Exp $
2.\"
3.\" Copyright (c) 2021 Ingo Schwarze <schwarze@openbsd.org>
4.\"
5.\" Permission to use, copy, modify, and distribute this software for any
6.\" purpose with or without fee is hereby granted, provided that the above
7.\" copyright notice and this permission notice appear in all copies.
8.\"
9.\" THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
10.\" WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
11.\" MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
12.\" ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
13.\" WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
14.\" ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
15.\" OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
16.\"
17.Dd $Mdocdate: July 12 2021 $
18.Dt X509V3_EXT_PRINT 3
19.Os
20.Sh NAME
21.Nm X509V3_EXT_print
22.Nd pretty-print an X.509 extension
23.Sh SYNOPSIS
24.In openssl/x509v3.h
25.Ft int
26.Fo X509V3_EXT_print
27.Fa "BIO *bio"
28.Fa "X509_EXTENSION *ext"
29.Fa "unsigned long flags"
30.Fa "int indent"
31.Fc
32.Sh DESCRIPTION
33.Fn X509V3_EXT_print
34decodes
35.Fa ext
36and prints the data contained in it to
37.Fa bio
38in a human-readable format with a left margin of
39.Fa indent
40space characters.
41The details of both the decoding and the printing depend on the type of
42.Fa ext .
43.Pp
44For most extension types, the decoding is done in the same way
45as it would be done by the appropriate public API function, for example:
46.Pp
47.Bl -tag -width NID_authority_key_identifier -compact
48.It Sy extension type
49.Sy decoding function
50.It Dv NID_subject_key_identifier
51.Xr d2i_ASN1_OCTET_STRING 3
52.It Dv NID_key_usage
53.Xr d2i_ASN1_BIT_STRING 3
54.It Dv NID_crl_number
55.Xr d2i_ASN1_INTEGER 3
56.It Dv NID_crl_reason
57.Xr d2i_ASN1_ENUMERATED 3
58.It Dv NID_invalidity_date
59.Xr d2i_ASN1_GENERALIZEDTIME 3
60.It Dv NID_subject_alt_name
61.Xr d2i_GENERAL_NAMES 3
62.It Dv NID_hold_instruction_code
63.Xr d2i_ASN1_OBJECT 3
64.It Dv NID_id_pkix_OCSP_noCheck
65.Xr d2i_ASN1_NULL 3
66.It Dv NID_authority_key_identifier
67.Xr d2i_AUTHORITY_KEYID 3
68.It Dv NID_certificate_policies
69.Xr d2i_CERTIFICATEPOLICIES 3
70.It Dv NID_id_pkix_OCSP_CrlID
71.Xr d2i_OCSP_CRLID 3
72.It Dv NID_id_pkix_OCSP_Nonce
73non-public function built into the library
74.El
75.Pp
76For some types, the printing is performed
77by a dedicated non-public function built into the library.
78For some other types, the printing function is a public API function,
79but none of these printing functions are documented yet.
80.Pp
81If
82.Fa ext
83is of an unknown extension type or if decoding fails
84while using the decoding function for the relevant type,
85the action taken depends on the
86.Fa flags
87argument:
88.Bl -bullet
89.It
90If the bit
91.Dv X509V3_EXT_PARSE_UNKNOWN
92is set,
93.Xr ASN1_parse_dump 3
94is called on the BER-encoded data of the extension, passing \-1 for the
95.Fa dump
96argument.
97Thus, some information about the encoding of the extension gets printed
98and some about its decoded content, falling back to
99.Xr BIO_dump_indent 3
100for the decoded content unless a dedicated printing method is known
101for the respective data type(s).
102Note that even if an extension type is unknown, the data type used
103by the unknown extension, or, if that data type is constructed, of
104the values contained in it, may still be known, which may allow
105printing the content of even an unknown extension in a structured
106or partially structured form.
107.It
108If the bit
109.Dv X509V3_EXT_DUMP_UNKNOWN
110is set,
111.Xr BIO_dump_indent 3
112is called on the BER-encoded data of the extension without decoding
113it first, which is usually less readable than the above but poses
114a smaller risk of omitting or misrepresenting parts of the information.
115.It
116If the bit
117.Dv X509V3_EXT_ERROR_UNKNOWN
118is set, only the fixed string
119.Qq "<Not Supported>"
120is printed for an unknown type or only the fixed string
121.Qq "<Parse Error>"
122if the parsing functions fails,
123but printing is considered as successful anyway.
124.It
125If more than one of these three bits is set, or if a bit in
126.Dv X509V3_EXT_UNKNOWN_MASK
127is set that is not listed above, nothing is printed, but printing
128is considered as successful anyway.
129.It
130If none of the bits in
131.Dv X509V3_EXT_UNKNOWN_MASK
132are set, nothing is printed and printing is considered as failed.
133.El
134.Sh RETURN VALUES
135.Fn X509V3_EXT_print
136returns 0 if failure was both detected and considered relevant.
137Otherwise, 1 is returned, and in general the user cannot tell whether
138failure simply went undetected, whether the function detected failure
139but regarded it as irrelevant, or whether printing did indeed
140succeed.
141.Sh SEE ALSO
142.Xr BIO_new 3 ,
143.Xr X509_EXTENSION_new 3 ,
144.Xr X509_get0_extensions 3 ,
145.Xr X509_get_ext 3
146.Sh HISTORY
147.Fn X509V3_EXT_print
148first appeared in OpenSSL 0.9.2 and has been available since
149.Ox 2.6 .
150.Sh BUGS
151.Fn X509V3_EXT_print
152lacks error handling throughout.
153When a write operation fails, it will usually ignore the fact that
154information was omitted from the output and report success to the
155caller anyway.