
#use wml::openssl-macros area=docs page=X509_NAME_print_ex

<title>Documents, X509_NAME_print_ex(3)</title>

<h1>X509_NAME_print_ex(3)</h1>

#use wml::imp::generic

{:
## What's this? [[s|(<STRONG>[^<].+?)</A>(</STRONG><DD>)|$1$2|sg]]
[[s|<P>\s+<P>|<P>|sg]]
[[s|<P>\s+</|</|sg]]
[[s|<DD>\s*<DT>|<DD>&nbsp;<DT>|sg]]
[[s|<DD>\s*</DL>|<DD>&nbsp;</DL>|sg]]
[[s|\[|&#91;|sg]]
[[s|\]|&#93;|sg]]

<!-- INDEX BEGIN -->

<UL>

	<LI><A HREF="#NAME">NAME</A>
	<LI><A HREF="#SYNOPSIS">SYNOPSIS</A>
	<LI><A HREF="#DESCRIPTION">DESCRIPTION</A>
	<LI><A HREF="#NOTES">NOTES</A>
	<LI><A HREF="#SEE_ALSO">SEE ALSO</A>
	<LI><A HREF="#HISTORY">HISTORY</A>
</UL>
<!-- INDEX END -->

<HR>
<P>
<HR>
<H1><A NAME="NAME">NAME</A></H1>
<P>
X509_NAME_print_ex, X509_NAME_print_ex_fp, X509_NAME_print,
X509_NAME_oneline - X509_NAME printing routines.

</P>
<P>
<HR>
<H1><A NAME="SYNOPSIS">SYNOPSIS</A></H1>
<PRE> #include &lt;openssl/x509.h&gt;
</PRE>
<PRE> int X509_NAME_print_ex(BIO *out, X509_NAME *nm, int indent, unsigned long flags);
 int X509_NAME_print_ex_fp(FILE *fp, X509_NAME *nm, int indent, unsigned long flags);
 char * X509_NAME_oneline(X509_NAME *a,char *buf,int size);
 int X509_NAME_print(BIO *bp, X509_NAME *name, int obase);
</PRE>
<P>
<HR>
<H1><A NAME="DESCRIPTION">DESCRIPTION</A></H1>
<P>
<CODE>X509_NAME_print_ex()</CODE> prints a human readable version of <STRONG>nm</STRONG> to BIO <STRONG>out</STRONG>. Each line (for multiline formats) is indented by <STRONG>indent</STRONG> spaces. The output format can be extensively customised by use of the <STRONG>flags</STRONG> parameter.

</P>
<P>
<CODE>X509_NAME_print_ex_fp()</CODE> is identical to
<CODE>X509_NAME_print_ex()</CODE> except the output is written to FILE
pointer <STRONG>fp</STRONG>.

</P>
<P>
<CODE>X509_NAME_oneline()</CODE> prints an ASCII version of <STRONG>a</STRONG> to <STRONG>buf</STRONG>. At most <STRONG>size</STRONG>
bytes will be written. If <STRONG>buf</STRONG> is <STRONG>NULL</STRONG> then a buffer is dynamically allocated and returned, otherwise <STRONG>buf</STRONG> is returned.

</P>
<P>
<CODE>X509_NAME_print()</CODE> prints out <STRONG>name</STRONG> to <STRONG>bp</STRONG> indenting each line by <STRONG>obase</STRONG> 
characters. Multiple lines are used if the output (including indent)
exceeds 80 characters.

</P>
<P>
<HR>
<H1><A NAME="NOTES">NOTES</A></H1>
<P>
The functions <CODE>X509_NAME_oneline()</CODE> and
<CODE>X509_NAME_print()</CODE> are legacy functions which produce a non
standard output form, they don't handle multi character fields and have
various quirks and inconsistencies. Their use is strongly discouraged in
new applications.

</P>
<P>
Although there are a large number of possible flags for most purposes
<STRONG>XN_FLAG_ONELINE</STRONG>, <STRONG>XN_FLAG_MULTILINE</STRONG> or <STRONG>XN_FLAG_RFC2253</STRONG> will suffice. As noted on the <A HREF="../crypto/ASN1_STRING_print_ex.html#">ASN1_STRING_print_ex(3)</A> manual page for UTF8 terminals the <STRONG>ASN1_STRFLGS_ESC_MSB</STRONG> should be unset: so for example
<STRONG>XN_FLAG_ONELINE & ~ASN1_STRFLGS_ESC_MSB</STRONG> would be used.

</P>
<P>
The complete set of the flags supported by
<CODE>X509_NAME_print_ex()</CODE> is listed below.

</P>
<P>
Several options can be ored together.

</P>
<P>
The options <STRONG>XN_FLAG_SEP_COMMA_PLUS</STRONG>, <STRONG>XN_FLAG_SEP_CPLUS_SPC</STRONG>,
<STRONG>XN_FLAG_SEP_SPLUS_SPC</STRONG> and <STRONG>XN_FLAG_SEP_MULTILINE</STRONG> determine the field separators to use. Two distinct separators are used
between distinct RelativeDistinguishedName components and separate values
in the same RDN for a multi-valued RDN. Multi-valued RDNs are currently
very rare so the second separator will hardly ever be used.

</P>
<P>
<STRONG>XN_FLAG_SEP_COMMA_PLUS</STRONG> uses comma and plus as separators. <STRONG>XN_FLAG_SEP_CPLUS_SPC</STRONG>
uses comma and plus with spaces: this is more readable that plain comma and
plus.
<STRONG>XN_FLAG_SEP_SPLUS_SPC</STRONG> uses spaced semicolon and plus. <STRONG>XN_FLAG_SEP_MULTILINE</STRONG> uses spaced newline and plus respectively.

</P>
<P>
If <STRONG>XN_FLAG_DN_REV</STRONG> is set the whole DN is printed in reversed order.

</P>
<P>
The fields <STRONG>XN_FLAG_FN_SN</STRONG>, <STRONG>XN_FLAG_FN_LN</STRONG>, <STRONG>XN_FLAG_FN_OID</STRONG>,
<STRONG>XN_FLAG_FN_NONE</STRONG> determine how a field name is displayed. It will use the short name (e.g.
CN) the long name (e.g. commonName) always use OID numerical form (normally
OIDs are only used if the field name is not recognised) and no field name
respectively.

</P>
<P>
If <STRONG>XN_FLAG_SPC_EQ</STRONG> is set then spaces will be placed around the '=' character separating field
names and values.

</P>
<P>
If <STRONG>XN_FLAG_DUMP_UNKNOWN_FIELDS</STRONG> is set then the encoding of unknown fields is printed instead of the
values.

</P>
<P>
If <STRONG>XN_FLAG_FN_ALIGN</STRONG> is set then field names are padded to 20 characters: this is only of use
for multiline format.

</P>
<P>
Additionally all the options supported by
<CODE>ASN1_STRING_print_ex()</CODE> can be used to control how each field
value is displayed.

</P>
<P>
In addition a number options can be set for commonly used formats.

</P>
<P>
<STRONG>XN_FLAG_RFC2253</STRONG> sets options which produce an output compatible with RFC2253 it is
equivalent to:
 <STRONG>ASN1_STRFLGS_RFC2253 | XN_FLAG_SEP_COMMA_PLUS | XN_FLAG_DN_REV | XN_FLAG_FN_SN | XN_FLAG_DUMP_UNKNOWN_FIELDS</STRONG>



</P>
<P>
<STRONG>XN_FLAG_ONELINE</STRONG> is a more readable one line format which is the same as:
 <STRONG>ASN1_STRFLGS_RFC2253 | ASN1_STRFLGS_ESC_QUOTE | XN_FLAG_SEP_CPLUS_SPC | XN_FLAG_SPC_EQ | XN_FLAG_FN_SN</STRONG>



</P>
<P>
<STRONG>XN_FLAG_MULTILINE</STRONG> is a multiline format which is the same as:
 <STRONG>ASN1_STRFLGS_ESC_CTRL | ASN1_STRFLGS_ESC_MSB | XN_FLAG_SEP_MULTILINE | XN_FLAG_SPC_EQ | XN_FLAG_FN_LN | XN_FLAG_FN_ALIGN</STRONG>



</P>
<P>
<STRONG>XN_FLAG_COMPAT</STRONG> uses a format identical to <CODE>X509_NAME_print():</CODE> in fact it calls
<CODE>X509_NAME_print()</CODE> internally.

</P>
<P>
<HR>
<H1><A NAME="SEE_ALSO">SEE ALSO</A></H1>
<P>
<A HREF="../crypto/ASN1_STRING_print_ex.html#">ASN1_STRING_print_ex(3)</A>



</P>
<P>
<HR>
<H1><A NAME="HISTORY">HISTORY</A></H1>
<P>
TBA

</P>
:}


