Blame doc/man3/ASN1_STRING_print_ex.pod

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