1 .\" $OpenBSD: X509_NAME_print_ex.3,v 1.6 2016/12/25 22:15:10 schwarze Exp $
2 .\" OpenSSL aebb9aac Jul 19 09:27:53 2016 -0400
4 .\" This file was written by Dr. Stephen Henson <steve@openssl.org>.
5 .\" Copyright (c) 2002, 2004, 2007, 2016 The OpenSSL Project.
6 .\" All rights reserved.
8 .\" Redistribution and use in source and binary forms, with or without
9 .\" modification, are permitted provided that the following conditions
12 .\" 1. Redistributions of source code must retain the above copyright
13 .\" notice, this list of conditions and the following disclaimer.
15 .\" 2. Redistributions in binary form must reproduce the above copyright
16 .\" notice, this list of conditions and the following disclaimer in
17 .\" the documentation and/or other materials provided with the
20 .\" 3. All advertising materials mentioning features or use of this
21 .\" software must display the following acknowledgment:
22 .\" "This product includes software developed by the OpenSSL Project
23 .\" for use in the OpenSSL Toolkit. (http://www.openssl.org/)"
25 .\" 4. The names "OpenSSL Toolkit" and "OpenSSL Project" must not be used to
26 .\" endorse or promote products derived from this software without
27 .\" prior written permission. For written permission, please contact
28 .\" openssl-core@openssl.org.
30 .\" 5. Products derived from this software may not be called "OpenSSL"
31 .\" nor may "OpenSSL" appear in their names without prior written
32 .\" permission of the OpenSSL Project.
34 .\" 6. Redistributions of any form whatsoever must retain the following
36 .\" "This product includes software developed by the OpenSSL Project
37 .\" for use in the OpenSSL Toolkit (http://www.openssl.org/)"
39 .\" THIS SOFTWARE IS PROVIDED BY THE OpenSSL PROJECT ``AS IS'' AND ANY
40 .\" EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
41 .\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
42 .\" PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE OpenSSL PROJECT OR
43 .\" ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
44 .\" SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
45 .\" NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
46 .\" LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
47 .\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
48 .\" STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
49 .\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
50 .\" OF THE POSSIBILITY OF SUCH DAMAGE.
52 .Dd $Mdocdate: December 25 2016 $
53 .Dt X509_NAME_PRINT_EX 3
56 .Nm X509_NAME_print_ex ,
57 .Nm X509_NAME_print_ex_fp ,
58 .Nm X509_NAME_oneline ,
60 .Nd X509_NAME printing routines
64 .Fo X509_NAME_print_ex
68 .Fa "unsigned long flags"
71 .Fo X509_NAME_print_ex_fp
75 .Fa "unsigned long flags"
90 .Fn X509_NAME_print_ex
91 prints a human readable version of
96 Each line (for multiline formats) is indented by
99 The output format can be extensively customised by use of the
103 .Fn X509_NAME_print_ex_fp
105 .Fn X509_NAME_print_ex
106 except the output is written to the
111 .Fn X509_NAME_oneline
112 prints an ASCII version of
120 then a buffer is dynamically allocated and returned, and
125 bytes will be written, including the ending NUL, and
134 indenting each line by
137 Multiple lines are used if the output (including indent) exceeds 80
141 .Fn X509_NAME_oneline
144 are legacy functions which produce a non-standard output form.
145 They don't handle multi-character fields and have various quirks
147 Their use is strongly discouraged in new applications.
149 Although there are a large number of possible flags, for most purposes
150 .Dv XN_FLAG_ONELINE ,
151 .Dv XN_FLAG_MULTILINE ,
156 .Xr ASN1_STRING_print_ex 3
157 manual page, for UTF-8 terminals the
158 .Dv ASN1_STRFLGS_ESC_MSB
159 should be unset: so for example
160 .Dv XN_FLAG_ONELINE No & Pf ~ Dv ASN1_STRFLGS_ESC_MSB
163 The complete set of the flags supported by
164 .Dv X509_NAME_print_ex
167 Several options can be OR'ed together.
170 .Dv XN_FLAG_SEP_COMMA_PLUS ,
171 .Dv XN_FLAG_SEP_CPLUS_SPC ,
172 .Dv XN_FLAG_SEP_SPLUS_SPC ,
174 .Dv XN_FLAG_SEP_MULTILINE
175 determine the field separators to use.
176 Two distinct separators are used between distinct
177 .Vt RelativeDistinguishedName
178 components and separate values in the same RDN for a multi-valued RDN.
179 Multi-valued RDNs are currently very rare so the second separator
180 will hardly ever be used.
182 .Dv XN_FLAG_SEP_COMMA_PLUS
183 uses comma and plus as separators.
184 .Dv XN_FLAG_SEP_CPLUS_SPC
185 uses comma and plus with spaces:
186 this is more readable that plain comma and plus.
187 .Dv XN_FLAG_SEP_SPLUS_SPC
188 uses spaced semicolon and plus.
189 .Dv XN_FLAG_SEP_MULTILINE
190 uses spaced newline and plus respectively.
194 is set, the whole DN is printed in reversed order.
202 determine how a field name is displayed.
203 It will use the short name (e.g. CN), the long name (e.g. commonName),
204 always use OID numerical form (normally OIDs are only used if the
205 field name is not recognised) and no field name, respectively.
209 is set, then spaces will be placed around the
211 character separating field names and values.
214 .Dv XN_FLAG_DUMP_UNKNOWN_FIELDS
215 is set, then the encoding of unknown fields is printed instead of the
220 is set, then field names are padded to 20 characters:
221 this is only of use for multiline format.
223 Additionally, all the options supported by
224 .Xr ASN1_STRING_print_ex 3
225 can be used to control how each field value is displayed.
227 In addition a number of options can be set for commonly used formats.
230 sets options which produce an output compatible with RFC 2253.
232 .Dv ASN1_STRFLGS_RFC2253 | XN_FLAG_SEP_COMMA_PLUS | XN_FLAG_DN_REV |
233 .Dv XN_FLAG_FN_SN | XN_FLAG_DUMP_UNKNOWN_FIELDS .
236 is a more readable one line format which is the same as:
237 .Dv ASN1_STRFLGS_RFC2253 | ASN1_STRFLGS_ESC_QUOTE | XN_FLAG_SEP_CPLUS_SPC |
238 .Dv XN_FLAG_SPC_EQ | XN_FLAG_FN_SN .
240 .Dv XN_FLAG_MULTILINE
241 is a multiline format which is the same as:
242 .Dv ASN1_STRFLGS_ESC_CTRL | ASN1_STRFLGS_ESC_MSB | XN_FLAG_SEP_MULTILINE |
243 .Dv XN_FLAG_SPC_EQ | XN_FLAG_FN_LN | XN_FLAG_FN_ALIGN .
246 uses a format identical to
247 .Fn X509_NAME_print :
252 .Xr ASN1_STRING_print_ex 3 ,
253 .Xr d2i_X509_NAME 3 ,
254 .Xr X509_NAME_get_index_by_NID 3 ,