diff options
Diffstat (limited to 'src/lib/libcrypto/man/ASN1_parse_dump.3')
| -rw-r--r-- | src/lib/libcrypto/man/ASN1_parse_dump.3 | 216 |
1 files changed, 0 insertions, 216 deletions
diff --git a/src/lib/libcrypto/man/ASN1_parse_dump.3 b/src/lib/libcrypto/man/ASN1_parse_dump.3 deleted file mode 100644 index 50761f38aa..0000000000 --- a/src/lib/libcrypto/man/ASN1_parse_dump.3 +++ /dev/null | |||
| @@ -1,216 +0,0 @@ | |||
| 1 | .\" $OpenBSD: ASN1_parse_dump.3,v 1.3 2021/12/09 18:52:09 schwarze Exp $ | ||
| 2 | .\" | ||
| 3 | .\" Copyright (c) 2021 Ingo Schwarze <schwarze@openbsd.org> | ||
| 4 | .\" | ||
| 5 | .\" Permission to use, copy, modify, and distribute this software for any | ||
| 6 | .\" purpose with or without fee is hereby granted, provided that the above | ||
| 7 | .\" copyright notice and this permission notice appear in all copies. | ||
| 8 | .\" | ||
| 9 | .\" THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES | ||
| 10 | .\" WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF | ||
| 11 | .\" MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR | ||
| 12 | .\" ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES | ||
| 13 | .\" WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN | ||
| 14 | .\" ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF | ||
| 15 | .\" OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. | ||
| 16 | .\" | ||
| 17 | .Dd $Mdocdate: December 9 2021 $ | ||
| 18 | .Dt ASN1_PARSE_DUMP 3 | ||
| 19 | .Os | ||
| 20 | .Sh NAME | ||
| 21 | .Nm ASN1_parse_dump , | ||
| 22 | .Nm ASN1_parse | ||
| 23 | .Nd parse BER and print information about it | ||
| 24 | .Sh SYNOPSIS | ||
| 25 | .In openssl/asn1.h | ||
| 26 | .Ft int | ||
| 27 | .Fo ASN1_parse_dump | ||
| 28 | .Fa "BIO *bio" | ||
| 29 | .Fa "const unsigned char *ber_in" | ||
| 30 | .Fa "long length" | ||
| 31 | .Fa "int indent" | ||
| 32 | .Fa "int dump" | ||
| 33 | .Fc | ||
| 34 | .Ft int | ||
| 35 | .Fo ASN1_parse | ||
| 36 | .Fa "BIO *bio" | ||
| 37 | .Fa "const unsigned char *ber_in" | ||
| 38 | .Fa "long length" | ||
| 39 | .Fa "int indent" | ||
| 40 | .Fc | ||
| 41 | .Sh DESCRIPTION | ||
| 42 | .Fn ASN1_parse_dump | ||
| 43 | parses BER-encoded values and prints information about them to | ||
| 44 | .Fa bio . | ||
| 45 | On function entry, | ||
| 46 | .Pf * Fa ber_in | ||
| 47 | is expected to point to the first identifier octet of an encoded value. | ||
| 48 | At most | ||
| 49 | .Fa length | ||
| 50 | bytes are inspected. | ||
| 51 | .Pp | ||
| 52 | For each value successfully parsed, the following information is printed: | ||
| 53 | .Bl -enum | ||
| 54 | .It | ||
| 55 | The index of its first identifier octet relative to | ||
| 56 | .Fa ber_in | ||
| 57 | as a decimal number followed by a colon. | ||
| 58 | For the first value parsed and printed, this is | ||
| 59 | .Qq 0:\& . | ||
| 60 | .It | ||
| 61 | The nesting depth as a decimal integer. | ||
| 62 | For the first value parsed and printed, this is | ||
| 63 | .Qq d=0 . | ||
| 64 | .It | ||
| 65 | The header length in bytes, including the identifier octets and the | ||
| 66 | length octets, as a decimal integer. | ||
| 67 | For example, for a boolean value, this is | ||
| 68 | .Qq hl=2 | ||
| 69 | because the encoding of a boolean value contains | ||
| 70 | one identifier octet (0x01) and one length octet (also 0x01, | ||
| 71 | because one content octet follows after the header). | ||
| 72 | .It | ||
| 73 | If the value is encoded using the definite form for the length octets, | ||
| 74 | the number encoded in the length octets as a decimal integer. | ||
| 75 | This is the number of content octets that follow. | ||
| 76 | For example, for a boolean value, this is | ||
| 77 | .Qq l=1 . | ||
| 78 | If the value is encoded using a length octet indicating the indefinite form, | ||
| 79 | .Qq l=inf | ||
| 80 | is printed instead. | ||
| 81 | .It | ||
| 82 | If the value is primitive, | ||
| 83 | .Qq prim:\& | ||
| 84 | is printed; | ||
| 85 | if it is constructed, | ||
| 86 | .Qq cons:\& . | ||
| 87 | .It | ||
| 88 | The next field depends on the class of the tag: | ||
| 89 | .Bl -tag -width Ds | ||
| 90 | .It Dv V_ASN1_PRIVATE | ||
| 91 | .Qq priv | ||
| 92 | followed by the decimal tag number in square brackets | ||
| 93 | .It Dv V_ASN1_CONTEXT_SPECIFIC | ||
| 94 | .Qq cont | ||
| 95 | followed by the decimal tag number in square brackets | ||
| 96 | .It Dv V_ASN1_APPLICATION | ||
| 97 | .Qq appl | ||
| 98 | followed by the decimal tag number in square brackets | ||
| 99 | .It V_ASN1_UNIVERSAL | ||
| 100 | If the tag number is 30 or less, the return value from | ||
| 101 | .Xr ASN1_tag2str 3 | ||
| 102 | is printed; otherwise, | ||
| 103 | .Qq <ASN1 | ||
| 104 | followed by the decimal tag number and a closing angle bracket. | ||
| 105 | .El | ||
| 106 | .El | ||
| 107 | .Pp | ||
| 108 | For constructed values, the contained values are recursively printed. | ||
| 109 | .Pp | ||
| 110 | Primitive values are processed as follows: | ||
| 111 | .Bl -tag -width Ds | ||
| 112 | .It Dv V_ASN1_BOOLEAN | ||
| 113 | Its integer value is printed as a decimal number. | ||
| 114 | .It Dv V_ASN1_INTEGER | ||
| 115 | Decoded with | ||
| 116 | .Xr d2i_ASN1_INTEGER 3 , | ||
| 117 | printed as a hexadecimal number with an even number of digits. | ||
| 118 | .It Dv V_ASN1_ENUMERATED | ||
| 119 | Decoded with | ||
| 120 | .Xr d2i_ASN1_ENUMERATED 3 , | ||
| 121 | printed as a hexadecimal number with an even number of digits. | ||
| 122 | .It Dv V_ASN1_OBJECT | ||
| 123 | Decoded with | ||
| 124 | .Xr d2i_ASN1_OBJECT 3 , | ||
| 125 | printed with | ||
| 126 | .Xr i2a_ASN1_OBJECT 3 . | ||
| 127 | .It Dv V_ASN1_OCTET_STRING | ||
| 128 | Decoded with | ||
| 129 | .Xr d2i_ASN1_OCTET_STRING 3 . | ||
| 130 | If the data consists only of printable ASCII characters, line feeds, | ||
| 131 | carriage returns and horizontal tabs, it is printed as an ASCII string. | ||
| 132 | .Pp | ||
| 133 | Otherwise, the | ||
| 134 | .Fa dump | ||
| 135 | argument decides the format. | ||
| 136 | If it is zero, a raw hex dump is emitted, consisting of two hexadecimal | ||
| 137 | digits for every data byte. | ||
| 138 | If | ||
| 139 | .Fa dump | ||
| 140 | is non-zero, | ||
| 141 | .Xr BIO_dump_indent 3 | ||
| 142 | is used. | ||
| 143 | Unless | ||
| 144 | .Fa dump | ||
| 145 | is \-1, the data is truncated after | ||
| 146 | .Fa dump | ||
| 147 | bytes. | ||
| 148 | .It Dv V_ASN1_PRINTABLESTRING | ||
| 149 | Printed as an ASCII string. | ||
| 150 | The same applies to | ||
| 151 | .Dv V_ASN1_IA5STRING , | ||
| 152 | .Dv V_ASN1_T61STRING , | ||
| 153 | .Dv V_ASN1_NUMERICSTRING , | ||
| 154 | .Dv V_ASN1_VISIBLESTRING , | ||
| 155 | .Dv V_ASN1_UTF8STRING , | ||
| 156 | .Dv V_ASN1_UTCTIME , | ||
| 157 | and | ||
| 158 | .Dv V_ASN1_GENERALIZEDTIME . | ||
| 159 | .It Other tags | ||
| 160 | If the | ||
| 161 | .Fa dump | ||
| 162 | argument is 0, their data is silently ignored. | ||
| 163 | If | ||
| 164 | .Fa dump | ||
| 165 | is non-zero, | ||
| 166 | .Xr BIO_dump_indent 3 | ||
| 167 | is used. | ||
| 168 | Unless | ||
| 169 | .Fa dump | ||
| 170 | is \-1, the data is truncated after | ||
| 171 | .Fa dump | ||
| 172 | bytes. | ||
| 173 | .El | ||
| 174 | .Pp | ||
| 175 | .Fn ASN1_parse | ||
| 176 | is identical to | ||
| 177 | .Fn ASN1_parse_dump | ||
| 178 | with 0 passed as the | ||
| 179 | .Fa dump | ||
| 180 | argument. | ||
| 181 | .Sh RETURN VALUES | ||
| 182 | These functions return 1 for success or 0 for failure. | ||
| 183 | .Pp | ||
| 184 | In particular, they print an error message to | ||
| 185 | .Fa bio , | ||
| 186 | abort parsing and printing, and return 0 | ||
| 187 | when parsing or decoding fails, when a recursive call fails, | ||
| 188 | when encountering a value extending beyond | ||
| 189 | .Fa length , | ||
| 190 | or when encountering a nesting level in excess of 128. | ||
| 191 | They also abort parsing and printing and return 0 | ||
| 192 | when any printing operation fails. | ||
| 193 | .Sh SEE ALSO | ||
| 194 | .Xr ASN1_get_object 3 , | ||
| 195 | .Xr ASN1_item_d2i 3 , | ||
| 196 | .Xr ASN1_item_new 3 , | ||
| 197 | .Xr ASN1_STRING_print 3 , | ||
| 198 | .Xr ASN1_TYPE_new 3 | ||
| 199 | .Sh STANDARDS | ||
| 200 | ITU-T Recommendation X.690, also known as ISO/IEC 8825-1: | ||
| 201 | Information technology - ASN.1 encoding rules: | ||
| 202 | Specification of Basic Encoding Rules (BER), Canonical Encoding | ||
| 203 | Rules (CER) and Distinguished Encoding Rules (DER), | ||
| 204 | section 8.1: General rules for encoding | ||
| 205 | .Sh HISTORY | ||
| 206 | .Fn ASN1_parse | ||
| 207 | first appeared in SSLeay 0.5.1 and has been available since | ||
| 208 | .Ox 2.4 . | ||
| 209 | .Pp | ||
| 210 | .Fn ASN1_parse_dump | ||
| 211 | first appeared in OpenSSL 0.9.6 and has been available since | ||
| 212 | .Ox 2.9 . | ||
| 213 | .Sh BUGS | ||
| 214 | The content of values tagged as | ||
| 215 | .Dv V_ASN1_BMPSTRING | ||
| 216 | is silently ignored and none of it is printed. | ||
