]> git.ipfire.org Git - thirdparty/openssl.git/blame - doc/man3/ASN1_STRING_print_ex.pod
Update copyright year
[thirdparty/openssl.git] / doc / man3 / ASN1_STRING_print_ex.pod
CommitLineData
0711be16
DSH
1=pod
2
3=head1 NAME
4
9e183d22
RS
5ASN1_tag2str, ASN1_STRING_print_ex, ASN1_STRING_print_ex_fp, ASN1_STRING_print
6- ASN1_STRING output routines
0711be16
DSH
7
8=head1 SYNOPSIS
9
10 #include <openssl/asn1.h>
11
9f5466b9
F
12 int ASN1_STRING_print_ex(BIO *out, const ASN1_STRING *str, unsigned long flags);
13 int ASN1_STRING_print_ex_fp(FILE *fp, const ASN1_STRING *str, unsigned long flags);
14 int ASN1_STRING_print(BIO *out, const ASN1_STRING *str);
0711be16 15
9e183d22 16 const char *ASN1_tag2str(int tag);
0711be16
DSH
17
18=head1 DESCRIPTION
19
20These functions output an B<ASN1_STRING> structure. B<ASN1_STRING> is used to
21represent all the ASN1 string types.
22
23ASN1_STRING_print_ex() outputs B<str> to B<out>, the format is determined by
24the options B<flags>. ASN1_STRING_print_ex_fp() is identical except it outputs
25to B<fp> instead.
26
27ASN1_STRING_print() prints B<str> to B<out> but using a different format to
28ASN1_STRING_print_ex(). It replaces unprintable characters (other than CR, LF)
29with '.'.
30
9e183d22
RS
31ASN1_tag2str() returns a human-readable name of the specified ASN.1 B<tag>.
32
0711be16
DSH
33=head1 NOTES
34
a95d7574
RS
35ASN1_STRING_print() is a deprecated function which should be avoided; use
36ASN1_STRING_print_ex() instead.
0711be16 37
1bc74519 38Although there are a large number of options frequently B<ASN1_STRFLGS_RFC2253> is
521aaafc 39suitable, or on UTF8 terminals B<ASN1_STRFLGS_RFC2253 & ~ASN1_STRFLGS_ESC_MSB>.
0711be16
DSH
40
41The complete set of supported options for B<flags> is listed below.
42
43Various characters can be escaped. If B<ASN1_STRFLGS_ESC_2253> is set the characters
44determined by RFC2253 are escaped. If B<ASN1_STRFLGS_ESC_CTRL> is set control
45characters are escaped. If B<ASN1_STRFLGS_ESC_MSB> is set characters with the
46MSB set are escaped: this option should B<not> be used if the terminal correctly
47interprets UTF8 sequences.
48
49Escaping takes several forms.
50
0501f02b 51If the character being escaped is a 16 bit character then the form "\UXXXX" is used
0711be16 52using exactly four characters for the hex representation. If it is 32 bits then
0501f02b 53"\WXXXXXXXX" is used using eight characters of its hex representation. These forms
0711be16
DSH
54will only be used if UTF8 conversion is not set (see below).
55
56Printable characters are normally escaped using the backslash '\' character. If
57B<ASN1_STRFLGS_ESC_QUOTE> is set then the whole string is instead surrounded by
58double quote characters: this is arguably more readable than the backslash
59notation. Other characters use the "\XX" using exactly two characters of the hex
60representation.
61
62If B<ASN1_STRFLGS_UTF8_CONVERT> is set then characters are converted to UTF8
63format first. If the terminal supports the display of UTF8 sequences then this
64option will correctly display multi byte characters.
65
66If B<ASN1_STRFLGS_IGNORE_TYPE> is set then the string type is not interpreted at
67all: everything is assumed to be one byte per character. This is primarily for
68debugging purposes and can result in confusing output in multi character strings.
69
70If B<ASN1_STRFLGS_SHOW_TYPE> is set then the string type itself is printed out
71before its value (for example "BMPSTRING"), this actually uses ASN1_tag2str().
72
73The content of a string instead of being interpreted can be "dumped": this just
74outputs the value of the string using the form #XXXX using hex format for each
75octet.
76
77If B<ASN1_STRFLGS_DUMP_ALL> is set then any type is dumped.
78
79Normally non character string types (such as OCTET STRING) are assumed to be
521aaafc 80one byte per character, if B<ASN1_STRFLGS_DUMP_UNKNOWN> is set then they will
0711be16
DSH
81be dumped instead.
82
1bc74519 83When a type is dumped normally just the content octets are printed, if
0711be16
DSH
84B<ASN1_STRFLGS_DUMP_DER> is set then the complete encoding is dumped
85instead (including tag and length octets).
86
87B<ASN1_STRFLGS_RFC2253> includes all the flags required by RFC2253. It is
88equivalent to:
89 ASN1_STRFLGS_ESC_2253 | ASN1_STRFLGS_ESC_CTRL | ASN1_STRFLGS_ESC_MSB |
90 ASN1_STRFLGS_UTF8_CONVERT | ASN1_STRFLGS_DUMP_UNKNOWN ASN1_STRFLGS_DUMP_DER
91
1f13ad31
PY
92=head1 RETURN VALUES
93
94ASN1_STRING_print_ex() and ASN1_STRING_print_ex_fp() return the number of
95characters written or -1 if an error occurred.
96
97ASN1_STRING_print() returns 1 on success or 0 on error.
98
99ASN1_tag2str() returns a human-readable name of the specified ASN.1 B<tag>.
100
0711be16
DSH
101=head1 SEE ALSO
102
9b86974e
RS
103L<X509_NAME_print_ex(3)>,
104L<ASN1_tag2str(3)>
0711be16 105
e2f92610
RS
106=head1 COPYRIGHT
107
61f805c1 108Copyright 2002-2018 The OpenSSL Project Authors. All Rights Reserved.
e2f92610
RS
109
110Licensed under the OpenSSL license (the "License"). You may not use
111this file except in compliance with the License. You can obtain a copy
112in the file LICENSE in the source distribution or at
113L<https://www.openssl.org/source/license.html>.
114
115=cut