2
0

ASN1_STRING_print_ex.pod 3.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596
  1. =pod
  2. =head1 NAME
  3. ASN1_STRING_print_ex, ASN1_STRING_print_ex_fp - ASN1_STRING output routines.
  4. =head1 SYNOPSIS
  5. #include <openssl/asn1.h>
  6. int ASN1_STRING_print_ex(BIO *out, ASN1_STRING *str, unsigned long flags);
  7. int ASN1_STRING_print_ex_fp(FILE *fp, ASN1_STRING *str, unsigned long flags);
  8. int ASN1_STRING_print(BIO *out, ASN1_STRING *str);
  9. =head1 DESCRIPTION
  10. These functions output an B<ASN1_STRING> structure. B<ASN1_STRING> is used to
  11. represent all the ASN1 string types.
  12. ASN1_STRING_print_ex() outputs B<str> to B<out>, the format is determined by
  13. the options B<flags>. ASN1_STRING_print_ex_fp() is identical except it outputs
  14. to B<fp> instead.
  15. ASN1_STRING_print() prints B<str> to B<out> but using a different format to
  16. ASN1_STRING_print_ex(). It replaces unprintable characters (other than CR, LF)
  17. with '.'.
  18. =head1 NOTES
  19. ASN1_STRING_print() is a legacy function which should be avoided in new applications.
  20. Although there are a large number of options frequently B<ASN1_STRFLGS_RFC2253> is
  21. suitable, or on UTF8 terminals B<ASN1_STRFLGS_RFC2253 & ~ASN1_STRFLGS_ESC_MSB>.
  22. The complete set of supported options for B<flags> is listed below.
  23. Various characters can be escaped. If B<ASN1_STRFLGS_ESC_2253> is set the characters
  24. determined by RFC2253 are escaped. If B<ASN1_STRFLGS_ESC_CTRL> is set control
  25. characters are escaped. If B<ASN1_STRFLGS_ESC_MSB> is set characters with the
  26. MSB set are escaped: this option should B<not> be used if the terminal correctly
  27. interprets UTF8 sequences.
  28. Escaping takes several forms.
  29. If the character being escaped is a 16 bit character then the form "\UXXXX" is used
  30. using exactly four characters for the hex representation. If it is 32 bits then
  31. "\WXXXXXXXX" is used using eight characters of its hex representation. These forms
  32. will only be used if UTF8 conversion is not set (see below).
  33. Printable characters are normally escaped using the backslash '\' character. If
  34. B<ASN1_STRFLGS_ESC_QUOTE> is set then the whole string is instead surrounded by
  35. double quote characters: this is arguably more readable than the backslash
  36. notation. Other characters use the "\XX" using exactly two characters of the hex
  37. representation.
  38. If B<ASN1_STRFLGS_UTF8_CONVERT> is set then characters are converted to UTF8
  39. format first. If the terminal supports the display of UTF8 sequences then this
  40. option will correctly display multi byte characters.
  41. If B<ASN1_STRFLGS_IGNORE_TYPE> is set then the string type is not interpreted at
  42. all: everything is assumed to be one byte per character. This is primarily for
  43. debugging purposes and can result in confusing output in multi character strings.
  44. If B<ASN1_STRFLGS_SHOW_TYPE> is set then the string type itself is printed out
  45. before its value (for example "BMPSTRING"), this actually uses ASN1_tag2str().
  46. The content of a string instead of being interpreted can be "dumped": this just
  47. outputs the value of the string using the form #XXXX using hex format for each
  48. octet.
  49. If B<ASN1_STRFLGS_DUMP_ALL> is set then any type is dumped.
  50. Normally non character string types (such as OCTET STRING) are assumed to be
  51. one byte per character, if B<ASN1_STRFLGS_DUMP_UNKNOWN> is set then they will
  52. be dumped instead.
  53. When a type is dumped normally just the content octets are printed, if
  54. B<ASN1_STRFLGS_DUMP_DER> is set then the complete encoding is dumped
  55. instead (including tag and length octets).
  56. B<ASN1_STRFLGS_RFC2253> includes all the flags required by RFC2253. It is
  57. equivalent to:
  58. ASN1_STRFLGS_ESC_2253 | ASN1_STRFLGS_ESC_CTRL | ASN1_STRFLGS_ESC_MSB |
  59. ASN1_STRFLGS_UTF8_CONVERT | ASN1_STRFLGS_DUMP_UNKNOWN ASN1_STRFLGS_DUMP_DER
  60. =head1 SEE ALSO
  61. L<X509_NAME_print_ex(3)|X509_NAME_print_ex(3)>,
  62. L<ASN1_tag2str(3)|ASN1_tag2str(3)>
  63. =head1 HISTORY
  64. TBA
  65. =cut