X509_NAME_print_ex.3ossl 7.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185
  1. .\" -*- mode: troff; coding: utf-8 -*-
  2. .\" Automatically generated by Pod::Man 5.01 (Pod::Simple 3.43)
  3. .\"
  4. .\" Standard preamble:
  5. .\" ========================================================================
  6. .de Sp \" Vertical space (when we can't use .PP)
  7. .if t .sp .5v
  8. .if n .sp
  9. ..
  10. .de Vb \" Begin verbatim text
  11. .ft CW
  12. .nf
  13. .ne \\$1
  14. ..
  15. .de Ve \" End verbatim text
  16. .ft R
  17. .fi
  18. ..
  19. .\" \*(C` and \*(C' are quotes in nroff, nothing in troff, for use with C<>.
  20. .ie n \{\
  21. . ds C` ""
  22. . ds C' ""
  23. 'br\}
  24. .el\{\
  25. . ds C`
  26. . ds C'
  27. 'br\}
  28. .\"
  29. .\" Escape single quotes in literal strings from groff's Unicode transform.
  30. .ie \n(.g .ds Aq \(aq
  31. .el .ds Aq '
  32. .\"
  33. .\" If the F register is >0, we'll generate index entries on stderr for
  34. .\" titles (.TH), headers (.SH), subsections (.SS), items (.Ip), and index
  35. .\" entries marked with X<> in POD. Of course, you'll have to process the
  36. .\" output yourself in some meaningful fashion.
  37. .\"
  38. .\" Avoid warning from groff about undefined register 'F'.
  39. .de IX
  40. ..
  41. .nr rF 0
  42. .if \n(.g .if rF .nr rF 1
  43. .if (\n(rF:(\n(.g==0)) \{\
  44. . if \nF \{\
  45. . de IX
  46. . tm Index:\\$1\t\\n%\t"\\$2"
  47. ..
  48. . if !\nF==2 \{\
  49. . nr % 0
  50. . nr F 2
  51. . \}
  52. . \}
  53. .\}
  54. .rr rF
  55. .\" ========================================================================
  56. .\"
  57. .IX Title "X509_NAME_PRINT_EX 3ossl"
  58. .TH X509_NAME_PRINT_EX 3ossl 2025-01-17 3.4.0 OpenSSL
  59. .\" For nroff, turn off justification. Always turn off hyphenation; it makes
  60. .\" way too many mistakes in technical documents.
  61. .if n .ad l
  62. .nh
  63. .SH NAME
  64. X509_NAME_print_ex, X509_NAME_print_ex_fp, X509_NAME_print,
  65. X509_NAME_oneline \- X509_NAME printing routines
  66. .SH SYNOPSIS
  67. .IX Header "SYNOPSIS"
  68. .Vb 1
  69. \& #include <openssl/x509.h>
  70. \&
  71. \& int X509_NAME_print_ex(BIO *out, const X509_NAME *nm,
  72. \& int indent, unsigned long flags);
  73. \& int X509_NAME_print_ex_fp(FILE *fp, const X509_NAME *nm,
  74. \& int indent, unsigned long flags);
  75. \& char *X509_NAME_oneline(const X509_NAME *a, char *buf, int size);
  76. \& int X509_NAME_print(BIO *bp, const X509_NAME *name, int obase);
  77. .Ve
  78. .SH DESCRIPTION
  79. .IX Header "DESCRIPTION"
  80. \&\fBX509_NAME_print_ex()\fR prints a human readable version of \fInm\fR to BIO \fIout\fR.
  81. Each line (for multiline formats) is indented by \fIindent\fR spaces. The
  82. output format can be extensively customised by use of the \fIflags\fR parameter.
  83. .PP
  84. \&\fBX509_NAME_print_ex_fp()\fR is identical to \fBX509_NAME_print_ex()\fR
  85. except the output is written to FILE pointer \fIfp\fR.
  86. .PP
  87. \&\fBX509_NAME_oneline()\fR prints an ASCII version of \fIa\fR to \fIbuf\fR.
  88. This supports multi-valued RDNs and escapes \fB/\fR and \fB+\fR characters in values.
  89. If \fIbuf\fR is \fBNULL\fR then a buffer is dynamically allocated and returned, and
  90. \&\fIsize\fR is ignored.
  91. Otherwise, at most \fIsize\fR bytes will be written, including the ending '\e0',
  92. and \fIbuf\fR is returned.
  93. .PP
  94. \&\fBX509_NAME_print()\fR prints out \fIname\fR to \fIbp\fR indenting each line by \fIobase\fR
  95. characters. Multiple lines are used if the output (including indent) exceeds
  96. 80 characters.
  97. .SH NOTES
  98. .IX Header "NOTES"
  99. The functions \fBX509_NAME_oneline()\fR and \fBX509_NAME_print()\fR
  100. produce a non standard output form, they don't handle multi-character fields and
  101. have various quirks and inconsistencies.
  102. Their use is strongly discouraged in new applications and they could
  103. be deprecated in a future release.
  104. .PP
  105. Although there are a large number of possible flags for most purposes
  106. \&\fBXN_FLAG_ONELINE\fR, \fBXN_FLAG_MULTILINE\fR or \fBXN_FLAG_RFC2253\fR will suffice.
  107. As noted on the \fBASN1_STRING_print_ex\fR\|(3) manual page
  108. for UTF8 terminals the \fBASN1_STRFLGS_ESC_MSB\fR should be unset: so for example
  109. \&\fBXN_FLAG_ONELINE & ~ASN1_STRFLGS_ESC_MSB\fR would be used.
  110. .PP
  111. The complete set of the flags supported by \fBX509_NAME_print_ex()\fR is listed below.
  112. .PP
  113. Several options can be ored together.
  114. .PP
  115. The options \fBXN_FLAG_SEP_COMMA_PLUS\fR, \fBXN_FLAG_SEP_CPLUS_SPC\fR,
  116. \&\fBXN_FLAG_SEP_SPLUS_SPC\fR and \fBXN_FLAG_SEP_MULTILINE\fR
  117. determine the field separators to use.
  118. Two distinct separators are used between distinct RelativeDistinguishedName
  119. components and separate values in the same RDN for a multi-valued RDN.
  120. Multi-valued RDNs are currently very rare
  121. so the second separator will hardly ever be used.
  122. .PP
  123. \&\fBXN_FLAG_SEP_COMMA_PLUS\fR uses comma and plus as separators.
  124. \&\fBXN_FLAG_SEP_CPLUS_SPC\fR uses comma and plus with spaces:
  125. this is more readable that plain comma and plus.
  126. \&\fBXN_FLAG_SEP_SPLUS_SPC\fR uses spaced semicolon and plus.
  127. \&\fBXN_FLAG_SEP_MULTILINE\fR uses spaced newline and plus respectively.
  128. .PP
  129. If \fBXN_FLAG_DN_REV\fR is set the whole DN is printed in reversed order.
  130. .PP
  131. The fields \fBXN_FLAG_FN_SN\fR, \fBXN_FLAG_FN_LN\fR, \fBXN_FLAG_FN_OID\fR,
  132. \&\fBXN_FLAG_FN_NONE\fR determine how a field name is displayed. It will
  133. use the short name (e.g. CN) the long name (e.g. commonName) always
  134. use OID numerical form (normally OIDs are only used if the field name is not
  135. recognised) and no field name respectively.
  136. .PP
  137. If \fBXN_FLAG_SPC_EQ\fR is set then spaces will be placed around the '=' character
  138. separating field names and values.
  139. .PP
  140. If \fBXN_FLAG_DUMP_UNKNOWN_FIELDS\fR is set then the encoding of unknown fields is
  141. printed instead of the values.
  142. .PP
  143. If \fBXN_FLAG_FN_ALIGN\fR is set then field names are padded to 20 characters: this
  144. is only of use for multiline format.
  145. .PP
  146. Additionally all the options supported by \fBASN1_STRING_print_ex()\fR can be used to
  147. control how each field value is displayed.
  148. .PP
  149. In addition a number options can be set for commonly used formats.
  150. .PP
  151. \&\fBXN_FLAG_RFC2253\fR sets options which produce an output compatible with RFC2253.
  152. It is equivalent to:
  153. \f(CW\*(C`ASN1_STRFLGS_RFC2253 | XN_FLAG_SEP_COMMA_PLUS | XN_FLAG_DN_REV
  154. | XN_FLAG_FN_SN | XN_FLAG_DUMP_UNKNOWN_FIELDS\*(C'\fR
  155. .PP
  156. \&\fBXN_FLAG_ONELINE\fR is a more readable one line format which is the same as:
  157. \f(CW\*(C`ASN1_STRFLGS_RFC2253 | ASN1_STRFLGS_ESC_QUOTE | XN_FLAG_SEP_CPLUS_SPC
  158. | XN_FLAG_SPC_EQ | XN_FLAG_FN_SN\*(C'\fR
  159. .PP
  160. \&\fBXN_FLAG_MULTILINE\fR is a multiline format which is the same as:
  161. \f(CW\*(C`ASN1_STRFLGS_ESC_CTRL | ASN1_STRFLGS_ESC_MSB | XN_FLAG_SEP_MULTILINE
  162. | XN_FLAG_SPC_EQ | XN_FLAG_FN_LN | XN_FLAG_FN_ALIGN\*(C'\fR
  163. .PP
  164. \&\fBXN_FLAG_COMPAT\fR uses a format identical to \fBX509_NAME_print()\fR:
  165. in fact it calls \fBX509_NAME_print()\fR internally.
  166. .SH "RETURN VALUES"
  167. .IX Header "RETURN VALUES"
  168. \&\fBX509_NAME_oneline()\fR returns a valid string on success or NULL on error.
  169. .PP
  170. \&\fBX509_NAME_print()\fR returns 1 on success or 0 on error.
  171. .PP
  172. \&\fBX509_NAME_print_ex()\fR and \fBX509_NAME_print_ex_fp()\fR return 1 on success or 0 on
  173. error if the \fBXN_FLAG_COMPAT\fR is set, which is the same as \fBX509_NAME_print()\fR.
  174. Otherwise, it returns \-1 on error or other values on success.
  175. .SH "SEE ALSO"
  176. .IX Header "SEE ALSO"
  177. \&\fBASN1_STRING_print_ex\fR\|(3)
  178. .SH COPYRIGHT
  179. .IX Header "COPYRIGHT"
  180. Copyright 2002\-2020 The OpenSSL Project Authors. All Rights Reserved.
  181. .PP
  182. Licensed under the Apache License 2.0 (the "License"). You may not use
  183. this file except in compliance with the License. You can obtain a copy
  184. in the file LICENSE in the source distribution or at
  185. <https://www.openssl.org/source/license.html>.