| 1 |
.\" -*- mode: troff; coding: utf-8 -*- |
| 2 |
.\" Automatically generated by Pod::Man 5.0102 (Pod::Simple 3.45) |
| 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 "ASN1_STRING_PRINT_EX 3SSL" |
| 58 |
.TH ASN1_STRING_PRINT_EX 3SSL 2026-04-07 3.6.2 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 |
ASN1_tag2str, ASN1_STRING_print_ex, ASN1_STRING_print_ex_fp, ASN1_STRING_print |
| 65 |
\&\- ASN1_STRING output routines |
| 66 |
.SH SYNOPSIS |
| 67 |
.IX Header "SYNOPSIS" |
| 68 |
.Vb 1 |
| 69 |
\& #include <openssl/asn1.h> |
| 70 |
\& |
| 71 |
\& int ASN1_STRING_print_ex(BIO *out, const ASN1_STRING *str, unsigned long flags); |
| 72 |
\& int ASN1_STRING_print_ex_fp(FILE *fp, const ASN1_STRING *str, unsigned long flags); |
| 73 |
\& int ASN1_STRING_print(BIO *out, const ASN1_STRING *str); |
| 74 |
\& |
| 75 |
\& const char *ASN1_tag2str(int tag); |
| 76 |
.Ve |
| 77 |
.SH DESCRIPTION |
| 78 |
.IX Header "DESCRIPTION" |
| 79 |
These functions output an \fBASN1_STRING\fR structure. \fBASN1_STRING\fR is used to |
| 80 |
represent all the ASN1 string types. |
| 81 |
.PP |
| 82 |
\&\fBASN1_STRING_print_ex()\fR outputs \fIstr\fR to \fIout\fR, the format is determined by |
| 83 |
the options \fIflags\fR. \fBASN1_STRING_print_ex_fp()\fR is identical except it outputs |
| 84 |
to \fIfp\fR instead. |
| 85 |
.PP |
| 86 |
\&\fBASN1_STRING_print()\fR prints \fIstr\fR to \fIout\fR but using a different format to |
| 87 |
\&\fBASN1_STRING_print_ex()\fR. It replaces unprintable characters (other than CR, LF) |
| 88 |
with '.'. |
| 89 |
.PP |
| 90 |
\&\fBASN1_tag2str()\fR returns a human-readable name of the specified ASN.1 \fItag\fR. |
| 91 |
.SH NOTES |
| 92 |
.IX Header "NOTES" |
| 93 |
\&\fBASN1_STRING_print()\fR is a deprecated function which should be avoided; use |
| 94 |
\&\fBASN1_STRING_print_ex()\fR instead. |
| 95 |
.PP |
| 96 |
Although there are a large number of options frequently \fBASN1_STRFLGS_RFC2253\fR is |
| 97 |
suitable, or on UTF8 terminals \fBASN1_STRFLGS_RFC2253 & ~ASN1_STRFLGS_ESC_MSB\fR. |
| 98 |
.PP |
| 99 |
The complete set of supported options for \fIflags\fR is listed below. |
| 100 |
.PP |
| 101 |
Various characters can be escaped. If \fBASN1_STRFLGS_ESC_2253\fR is set the characters |
| 102 |
determined by RFC2253 are escaped. If \fBASN1_STRFLGS_ESC_CTRL\fR is set control |
| 103 |
characters are escaped. If \fBASN1_STRFLGS_ESC_MSB\fR is set characters with the |
| 104 |
MSB set are escaped: this option should \fBnot\fR be used if the terminal correctly |
| 105 |
interprets UTF8 sequences. |
| 106 |
.PP |
| 107 |
Escaping takes several forms. |
| 108 |
.PP |
| 109 |
If the character being escaped is a 16 bit character then the form "\eUXXXX" is used |
| 110 |
using exactly four characters for the hex representation. If it is 32 bits then |
| 111 |
"\eWXXXXXXXX" is used using eight characters of its hex representation. These forms |
| 112 |
will only be used if UTF8 conversion is not set (see below). |
| 113 |
.PP |
| 114 |
Printable characters are normally escaped using the backslash '\e' character. If |
| 115 |
\&\fBASN1_STRFLGS_ESC_QUOTE\fR is set then the whole string is instead surrounded by |
| 116 |
double quote characters: this is arguably more readable than the backslash |
| 117 |
notation. Other characters use the "\eXX" using exactly two characters of the hex |
| 118 |
representation. |
| 119 |
.PP |
| 120 |
If \fBASN1_STRFLGS_UTF8_CONVERT\fR is set then characters are converted to UTF8 |
| 121 |
format first. If the terminal supports the display of UTF8 sequences then this |
| 122 |
option will correctly display multi byte characters. |
| 123 |
.PP |
| 124 |
If \fBASN1_STRFLGS_IGNORE_TYPE\fR is set then the string type is not interpreted at |
| 125 |
all: everything is assumed to be one byte per character. This is primarily for |
| 126 |
debugging purposes and can result in confusing output in multi character strings. |
| 127 |
.PP |
| 128 |
If \fBASN1_STRFLGS_SHOW_TYPE\fR is set then the string type itself is printed out |
| 129 |
before its value (for example "BMPSTRING"), this actually uses \fBASN1_tag2str()\fR. |
| 130 |
.PP |
| 131 |
The content of a string instead of being interpreted can be "dumped": this just |
| 132 |
outputs the value of the string using the form #XXXX using hex format for each |
| 133 |
octet. |
| 134 |
.PP |
| 135 |
If \fBASN1_STRFLGS_DUMP_ALL\fR is set then any type is dumped. |
| 136 |
.PP |
| 137 |
Normally non character string types (such as OCTET STRING) are assumed to be |
| 138 |
one byte per character, if \fBASN1_STRFLGS_DUMP_UNKNOWN\fR is set then they will |
| 139 |
be dumped instead. |
| 140 |
.PP |
| 141 |
When a type is dumped normally just the content octets are printed, if |
| 142 |
\&\fBASN1_STRFLGS_DUMP_DER\fR is set then the complete encoding is dumped |
| 143 |
instead (including tag and length octets). |
| 144 |
.PP |
| 145 |
\&\fBASN1_STRFLGS_RFC2253\fR includes all the flags required by RFC2253. It is |
| 146 |
equivalent to: |
| 147 |
ASN1_STRFLGS_ESC_2253 | ASN1_STRFLGS_ESC_CTRL | ASN1_STRFLGS_ESC_MSB | |
| 148 |
ASN1_STRFLGS_UTF8_CONVERT | ASN1_STRFLGS_DUMP_UNKNOWN ASN1_STRFLGS_DUMP_DER |
| 149 |
.SH "RETURN VALUES" |
| 150 |
.IX Header "RETURN VALUES" |
| 151 |
\&\fBASN1_STRING_print_ex()\fR and \fBASN1_STRING_print_ex_fp()\fR return the number of |
| 152 |
characters written or \-1 if an error occurred. |
| 153 |
.PP |
| 154 |
\&\fBASN1_STRING_print()\fR returns 1 on success or 0 on error. |
| 155 |
.PP |
| 156 |
\&\fBASN1_tag2str()\fR returns a human-readable name of the specified ASN.1 \fItag\fR. |
| 157 |
.SH "SEE ALSO" |
| 158 |
.IX Header "SEE ALSO" |
| 159 |
\&\fBX509_NAME_print_ex\fR\|(3), |
| 160 |
\&\fBASN1_tag2str\fR\|(3) |
| 161 |
.SH COPYRIGHT |
| 162 |
.IX Header "COPYRIGHT" |
| 163 |
Copyright 2002\-2018 The OpenSSL Project Authors. All Rights Reserved. |
| 164 |
.PP |
| 165 |
Licensed under the Apache License 2.0 (the "License"). You may not use |
| 166 |
this file except in compliance with the License. You can obtain a copy |
| 167 |
in the file LICENSE in the source distribution or at |
| 168 |
<https://www.openssl.org/source/license.html>. |