2002-10-20 21:20:57 +08:00
|
|
|
=pod
|
|
|
|
|
|
|
|
=head1 NAME
|
|
|
|
|
2017-03-11 21:56:44 +08:00
|
|
|
ASN1_tag2str, ASN1_STRING_print_ex, ASN1_STRING_print_ex_fp, ASN1_STRING_print
|
|
|
|
- ASN1_STRING output routines
|
2002-10-20 21:20:57 +08:00
|
|
|
|
|
|
|
=head1 SYNOPSIS
|
|
|
|
|
|
|
|
#include <openssl/asn1.h>
|
|
|
|
|
2016-07-08 05:45:55 +08:00
|
|
|
int ASN1_STRING_print_ex(BIO *out, const ASN1_STRING *str, unsigned long flags);
|
|
|
|
int ASN1_STRING_print_ex_fp(FILE *fp, const ASN1_STRING *str, unsigned long flags);
|
|
|
|
int ASN1_STRING_print(BIO *out, const ASN1_STRING *str);
|
2002-10-20 21:20:57 +08:00
|
|
|
|
2017-03-11 21:56:44 +08:00
|
|
|
const char *ASN1_tag2str(int tag);
|
2002-10-20 21:20:57 +08:00
|
|
|
|
|
|
|
=head1 DESCRIPTION
|
|
|
|
|
|
|
|
These functions output an B<ASN1_STRING> structure. B<ASN1_STRING> is used to
|
|
|
|
represent all the ASN1 string types.
|
|
|
|
|
|
|
|
ASN1_STRING_print_ex() outputs B<str> to B<out>, the format is determined by
|
|
|
|
the options B<flags>. ASN1_STRING_print_ex_fp() is identical except it outputs
|
|
|
|
to B<fp> instead.
|
|
|
|
|
|
|
|
ASN1_STRING_print() prints B<str> to B<out> but using a different format to
|
|
|
|
ASN1_STRING_print_ex(). It replaces unprintable characters (other than CR, LF)
|
|
|
|
with '.'.
|
|
|
|
|
2017-03-11 21:56:44 +08:00
|
|
|
ASN1_tag2str() returns a human-readable name of the specified ASN.1 B<tag>.
|
|
|
|
|
2002-10-20 21:20:57 +08:00
|
|
|
=head1 NOTES
|
|
|
|
|
|
|
|
ASN1_STRING_print() is a legacy function which should be avoided in new applications.
|
|
|
|
|
2016-05-20 20:11:46 +08:00
|
|
|
Although there are a large number of options frequently B<ASN1_STRFLGS_RFC2253> is
|
2004-11-13 21:38:34 +08:00
|
|
|
suitable, or on UTF8 terminals B<ASN1_STRFLGS_RFC2253 & ~ASN1_STRFLGS_ESC_MSB>.
|
2002-10-20 21:20:57 +08:00
|
|
|
|
|
|
|
The complete set of supported options for B<flags> is listed below.
|
|
|
|
|
|
|
|
Various characters can be escaped. If B<ASN1_STRFLGS_ESC_2253> is set the characters
|
|
|
|
determined by RFC2253 are escaped. If B<ASN1_STRFLGS_ESC_CTRL> is set control
|
|
|
|
characters are escaped. If B<ASN1_STRFLGS_ESC_MSB> is set characters with the
|
|
|
|
MSB set are escaped: this option should B<not> be used if the terminal correctly
|
|
|
|
interprets UTF8 sequences.
|
|
|
|
|
|
|
|
Escaping takes several forms.
|
|
|
|
|
2007-02-03 18:28:08 +08:00
|
|
|
If the character being escaped is a 16 bit character then the form "\UXXXX" is used
|
2002-10-20 21:20:57 +08:00
|
|
|
using exactly four characters for the hex representation. If it is 32 bits then
|
2007-02-03 18:28:08 +08:00
|
|
|
"\WXXXXXXXX" is used using eight characters of its hex representation. These forms
|
2002-10-20 21:20:57 +08:00
|
|
|
will only be used if UTF8 conversion is not set (see below).
|
|
|
|
|
|
|
|
Printable characters are normally escaped using the backslash '\' character. If
|
|
|
|
B<ASN1_STRFLGS_ESC_QUOTE> is set then the whole string is instead surrounded by
|
|
|
|
double quote characters: this is arguably more readable than the backslash
|
|
|
|
notation. Other characters use the "\XX" using exactly two characters of the hex
|
|
|
|
representation.
|
|
|
|
|
|
|
|
If B<ASN1_STRFLGS_UTF8_CONVERT> is set then characters are converted to UTF8
|
|
|
|
format first. If the terminal supports the display of UTF8 sequences then this
|
|
|
|
option will correctly display multi byte characters.
|
|
|
|
|
|
|
|
If B<ASN1_STRFLGS_IGNORE_TYPE> is set then the string type is not interpreted at
|
|
|
|
all: everything is assumed to be one byte per character. This is primarily for
|
|
|
|
debugging purposes and can result in confusing output in multi character strings.
|
|
|
|
|
|
|
|
If B<ASN1_STRFLGS_SHOW_TYPE> is set then the string type itself is printed out
|
|
|
|
before its value (for example "BMPSTRING"), this actually uses ASN1_tag2str().
|
|
|
|
|
|
|
|
The content of a string instead of being interpreted can be "dumped": this just
|
|
|
|
outputs the value of the string using the form #XXXX using hex format for each
|
|
|
|
octet.
|
|
|
|
|
|
|
|
If B<ASN1_STRFLGS_DUMP_ALL> is set then any type is dumped.
|
|
|
|
|
|
|
|
Normally non character string types (such as OCTET STRING) are assumed to be
|
2004-11-13 21:38:34 +08:00
|
|
|
one byte per character, if B<ASN1_STRFLGS_DUMP_UNKNOWN> is set then they will
|
2002-10-20 21:20:57 +08:00
|
|
|
be dumped instead.
|
|
|
|
|
2016-05-20 20:11:46 +08:00
|
|
|
When a type is dumped normally just the content octets are printed, if
|
2002-10-20 21:20:57 +08:00
|
|
|
B<ASN1_STRFLGS_DUMP_DER> is set then the complete encoding is dumped
|
|
|
|
instead (including tag and length octets).
|
|
|
|
|
|
|
|
B<ASN1_STRFLGS_RFC2253> includes all the flags required by RFC2253. It is
|
|
|
|
equivalent to:
|
|
|
|
ASN1_STRFLGS_ESC_2253 | ASN1_STRFLGS_ESC_CTRL | ASN1_STRFLGS_ESC_MSB |
|
|
|
|
ASN1_STRFLGS_UTF8_CONVERT | ASN1_STRFLGS_DUMP_UNKNOWN ASN1_STRFLGS_DUMP_DER
|
|
|
|
|
|
|
|
=head1 SEE ALSO
|
|
|
|
|
2015-08-18 03:21:33 +08:00
|
|
|
L<X509_NAME_print_ex(3)>,
|
|
|
|
L<ASN1_tag2str(3)>
|
2002-10-20 21:20:57 +08:00
|
|
|
|
2016-05-18 23:44:05 +08:00
|
|
|
=head1 COPYRIGHT
|
|
|
|
|
2017-03-11 21:56:44 +08:00
|
|
|
Copyright 2002-2017 The OpenSSL Project Authors. All Rights Reserved.
|
2016-05-18 23:44:05 +08:00
|
|
|
|
|
|
|
Licensed under the OpenSSL license (the "License"). You may not use
|
|
|
|
this file except in compliance with the License. You can obtain a copy
|
|
|
|
in the file LICENSE in the source distribution or at
|
|
|
|
L<https://www.openssl.org/source/license.html>.
|
|
|
|
|
|
|
|
=cut
|