1ASN1_STRING_print_ex(3) OpenSSL ASN1_STRING_print_ex(3)
2
3
4
6 ASN1_STRING_print_ex, ASN1_STRING_print_ex_fp - ASN1_STRING output rou‐
7 tines.
8
10 #include <openssl/asn1.h>
11
12 int ASN1_STRING_print_ex(BIO *out, ASN1_STRING *str, unsigned long flags);
13 int ASN1_STRING_print_ex_fp(FILE *fp, ASN1_STRING *str, unsigned long flags);
14 int ASN1_STRING_print(BIO *out, ASN1_STRING *str);
15
17 These functions output an ASN1_STRING structure. ASN1_STRING is used to
18 represent all the ASN1 string types.
19
20 ASN1_STRING_print_ex() outputs str to out, the format is determined by
21 the options flags. ASN1_STRING_print_ex_fp() is identical except it
22 outputs to fp instead.
23
24 ASN1_STRING_print() prints str to out but using a different format to
25 ASN1_STRING_print_ex(). It replaces unprintable characters (other than
26 CR, LF) with '.'.
27
29 ASN1_STRING_print() is a legacy function which should be avoided in new
30 applications.
31
32 Although there are a large number of options frequently ASN1_STR‐
33 FLGS_RFC2253 is suitable, or on UTF8 terminals ASN1_STRFLGS_RFC2253 &
34 ~ASN1_STRFLGS_ESC_MSB.
35
36 The complete set of supported options for flags is listed below.
37
38 Various characters can be escaped. If ASN1_STRFLGS_ESC_2253 is set the
39 characters determined by RFC2253 are escaped. If ASN1_STRFLGS_ESC_CTRL
40 is set control characters are escaped. If ASN1_STRFLGS_ESC_MSB is set
41 characters with the MSB set are escaped: this option should not be used
42 if the terminal correctly interprets UTF8 sequences.
43
44 Escaping takes several forms.
45
46 If the character being escaped is a 16 bit character then the form
47 "\WXXXX" is used using exactly four characters for the hex representa‐
48 tion. If it is 32 bits then "\UXXXXXXXX" is used using eight characters
49 of its hex representation. These forms will only be used if UTF8 con‐
50 version is not set (see below).
51
52 Printable characters are normally escaped using the backslash '\' char‐
53 acter. If ASN1_STRFLGS_ESC_QUOTE is set then the whole string is
54 instead surrounded by double quote characters: this is arguably more
55 readable than the backslash notation. Other characters use the "\XX"
56 using exactly two characters of the hex representation.
57
58 If ASN1_STRFLGS_UTF8_CONVERT is set then characters are converted to
59 UTF8 format first. If the terminal supports the display of UTF8
60 sequences then this option will correctly display multi byte charac‐
61 ters.
62
63 If ASN1_STRFLGS_IGNORE_TYPE is set then the string type is not inter‐
64 preted at all: everything is assumed to be one byte per character. This
65 is primarily for debugging purposes and can result in confusing output
66 in multi character strings.
67
68 If ASN1_STRFLGS_SHOW_TYPE is set then the string type itself is printed
69 out before its value (for example "BMPSTRING"), this actually uses
70 ASN1_tag2str().
71
72 The content of a string instead of being interpreted can be "dumped":
73 this just outputs the value of the string using the form #XXXX using
74 hex format for each octet.
75
76 If ASN1_STRFLGS_DUMP_ALL is set then any type is dumped.
77
78 Normally non character string types (such as OCTET STRING) are assumed
79 to be one byte per character, if ASN1_STRFLGS_DUMP_UNKNOWN is set then
80 they will be dumped instead.
81
82 When a type is dumped normally just the content octets are printed, if
83 ASN1_STRFLGS_DUMP_DER is set then the complete encoding is dumped
84 instead (including tag and length octets).
85
86 ASN1_STRFLGS_RFC2253 includes all the flags required by RFC2253. It is
87 equivalent to:
88 ASN1_STRFLGS_ESC_2253 ⎪ ASN1_STRFLGS_ESC_CTRL ⎪ ASN1_STRFLGS_ESC_MSB ⎪
89 ASN1_STRFLGS_UTF8_CONVERT ⎪ ASN1_STRFLGS_DUMP_UNKNOWN ASN1_STR‐
90 FLGS_DUMP_DER
91
93 X509_NAME_print_ex(3), ASN1_tag2str(3)
94
96 TBA
97
98
99
1000.9.8b 2004-11-13 ASN1_STRING_print_ex(3)