1ASN1_STRING_PRINT_EX(3)             OpenSSL            ASN1_STRING_PRINT_EX(3)
2
3
4

NAME

6       ASN1_tag2str, ASN1_STRING_print_ex, ASN1_STRING_print_ex_fp,
7       ASN1_STRING_print - ASN1_STRING output routines
8

SYNOPSIS

10        #include <openssl/asn1.h>
11
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);
15
16        const char *ASN1_tag2str(int tag);
17

DESCRIPTION

19       These functions output an ASN1_STRING structure. ASN1_STRING is used to
20       represent all the ASN1 string types.
21
22       ASN1_STRING_print_ex() outputs str to out, the format is determined by
23       the options flags. ASN1_STRING_print_ex_fp() is identical except it
24       outputs to fp instead.
25
26       ASN1_STRING_print() prints str to out but using a different format to
27       ASN1_STRING_print_ex(). It replaces unprintable characters (other than
28       CR, LF) with '.'.
29
30       ASN1_tag2str() returns a human-readable name of the specified ASN.1
31       tag.
32

NOTES

34       ASN1_STRING_print() is a deprecated function which should be avoided;
35       use ASN1_STRING_print_ex() instead.
36
37       Although there are a large number of options frequently
38       ASN1_STRFLGS_RFC2253 is suitable, or on UTF8 terminals
39       ASN1_STRFLGS_RFC2253 & ~ASN1_STRFLGS_ESC_MSB.
40
41       The complete set of supported options for flags is listed below.
42
43       Various characters can be escaped. If ASN1_STRFLGS_ESC_2253 is set the
44       characters determined by RFC2253 are escaped. If ASN1_STRFLGS_ESC_CTRL
45       is set control characters are escaped. If ASN1_STRFLGS_ESC_MSB is set
46       characters with the MSB set are escaped: this option should not be used
47       if the terminal correctly interprets UTF8 sequences.
48
49       Escaping takes several forms.
50
51       If the character being escaped is a 16 bit character then the form
52       "\UXXXX" is used using exactly four characters for the hex
53       representation. If it is 32 bits then "\WXXXXXXXX" is used using eight
54       characters of its hex representation. These forms will only be used if
55       UTF8 conversion is not set (see below).
56
57       Printable characters are normally escaped using the backslash '\'
58       character. If ASN1_STRFLGS_ESC_QUOTE is set then the whole string is
59       instead surrounded by double quote characters: this is arguably more
60       readable than the backslash notation. Other characters use the "\XX"
61       using exactly two characters of the hex representation.
62
63       If ASN1_STRFLGS_UTF8_CONVERT is set then characters are converted to
64       UTF8 format first. If the terminal supports the display of UTF8
65       sequences then this option will correctly display multi byte
66       characters.
67
68       If ASN1_STRFLGS_IGNORE_TYPE is set then the string type is not
69       interpreted at all: everything is assumed to be one byte per character.
70       This is primarily for debugging purposes and can result in confusing
71       output in multi character strings.
72
73       If ASN1_STRFLGS_SHOW_TYPE is set then the string type itself is printed
74       out before its value (for example "BMPSTRING"), this actually uses
75       ASN1_tag2str().
76
77       The content of a string instead of being interpreted can be "dumped":
78       this just outputs the value of the string using the form #XXXX using
79       hex format for each octet.
80
81       If ASN1_STRFLGS_DUMP_ALL is set then any type is dumped.
82
83       Normally non character string types (such as OCTET STRING) are assumed
84       to be one byte per character, if ASN1_STRFLGS_DUMP_UNKNOWN is set then
85       they will be dumped instead.
86
87       When a type is dumped normally just the content octets are printed, if
88       ASN1_STRFLGS_DUMP_DER is set then the complete encoding is dumped
89       instead (including tag and length octets).
90
91       ASN1_STRFLGS_RFC2253 includes all the flags required by RFC2253. It is
92       equivalent to:
93        ASN1_STRFLGS_ESC_2253 | ASN1_STRFLGS_ESC_CTRL | ASN1_STRFLGS_ESC_MSB |
94        ASN1_STRFLGS_UTF8_CONVERT | ASN1_STRFLGS_DUMP_UNKNOWN
95       ASN1_STRFLGS_DUMP_DER
96

RETURN VALUES

98       ASN1_STRING_print_ex() and ASN1_STRING_print_ex_fp() return the number
99       of characters written or -1 if an error occurred.
100
101       ASN1_STRING_print() returns 1 on success or 0 on error.
102
103       ASN1_tag2str() returns a human-readable name of the specified ASN.1
104       tag.
105

SEE ALSO

107       X509_NAME_print_ex(3), ASN1_tag2str(3)
108
110       Copyright 2002-2018 The OpenSSL Project Authors. All Rights Reserved.
111
112       Licensed under the OpenSSL license (the "License").  You may not use
113       this file except in compliance with the License.  You can obtain a copy
114       in the file LICENSE in the source distribution or at
115       <https://www.openssl.org/source/license.html>.
116
117
118
1191.1.1q                            2023-07-20           ASN1_STRING_PRINT_EX(3)
Impressum