.\" $OpenBSD: ASN1_parse_dump.3,v 1.3 2021/12/09 18:52:09 schwarze Exp $ .\" .\" Copyright (c) 2021 Ingo Schwarze .\" .\" Permission to use, copy, modify, and distribute this software for any .\" purpose with or without fee is hereby granted, provided that the above .\" copyright notice and this permission notice appear in all copies. .\" .\" THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES .\" WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF .\" MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR .\" ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES .\" WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN .\" ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF .\" OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. .\" .Dd $Mdocdate: December 9 2021 $ .Dt ASN1_PARSE_DUMP 3 .Os .Sh NAME .Nm ASN1_parse_dump , .Nm ASN1_parse .Nd parse BER and print information about it .Sh SYNOPSIS .In openssl/asn1.h .Ft int .Fo ASN1_parse_dump .Fa "BIO *bio" .Fa "const unsigned char *ber_in" .Fa "long length" .Fa "int indent" .Fa "int dump" .Fc .Ft int .Fo ASN1_parse .Fa "BIO *bio" .Fa "const unsigned char *ber_in" .Fa "long length" .Fa "int indent" .Fc .Sh DESCRIPTION .Fn ASN1_parse_dump parses BER-encoded values and prints information about them to .Fa bio . On function entry, .Pf * Fa ber_in is expected to point to the first identifier octet of an encoded value. At most .Fa length bytes are inspected. .Pp For each value successfully parsed, the following information is printed: .Bl -enum .It The index of its first identifier octet relative to .Fa ber_in as a decimal number followed by a colon. For the first value parsed and printed, this is .Qq 0:\& . .It The nesting depth as a decimal integer. For the first value parsed and printed, this is .Qq d=0 . .It The header length in bytes, including the identifier octets and the length octets, as a decimal integer. For example, for a boolean value, this is .Qq hl=2 because the encoding of a boolean value contains one identifier octet (0x01) and one length octet (also 0x01, because one content octet follows after the header). .It If the value is encoded using the definite form for the length octets, the number encoded in the length octets as a decimal integer. This is the number of content octets that follow. For example, for a boolean value, this is .Qq l=1 . If the value is encoded using a length octet indicating the indefinite form, .Qq l=inf is printed instead. .It If the value is primitive, .Qq prim:\& is printed; if it is constructed, .Qq cons:\& . .It The next field depends on the class of the tag: .Bl -tag -width Ds .It Dv V_ASN1_PRIVATE .Qq priv followed by the decimal tag number in square brackets .It Dv V_ASN1_CONTEXT_SPECIFIC .Qq cont followed by the decimal tag number in square brackets .It Dv V_ASN1_APPLICATION .Qq appl followed by the decimal tag number in square brackets .It V_ASN1_UNIVERSAL If the tag number is 30 or less, the return value from .Xr ASN1_tag2str 3 is printed; otherwise, .Qq