| ASN1_PARSE_DUMP(3) | Library Functions Manual | ASN1_PARSE_DUMP(3) |
ASN1_parse_dump,
ASN1_parse — parse BER and
print information about it
#include
<openssl/asn1.h>
int
ASN1_parse_dump(BIO *bio,
const unsigned char *ber_in, long
length, int indent, int
dump);
int
ASN1_parse(BIO *bio,
const unsigned char *ber_in, long
length, int indent);
ASN1_parse_dump()
parses BER-encoded values and prints information about them to
bio. On function entry, *ber_in
is expected to point to the first identifier octet of an encoded value. At
most length bytes are inspected.
For each value successfully parsed, the following information is printed:
V_ASN1_PRIVATEV_ASN1_CONTEXT_SPECIFICV_ASN1_APPLICATIONFor constructed values, the contained values are recursively printed.
Primitive values are processed as follows:
V_ASN1_BOOLEANV_ASN1_INTEGERV_ASN1_ENUMERATEDV_ASN1_OBJECTV_ASN1_OCTET_STRINGOtherwise, the dump argument decides the format. If it is zero, a raw hex dump is emitted, consisting of two hexadecimal digits for every data byte. If dump is non-zero, BIO_dump_indent(3) is used. Unless dump is -1, the data is truncated after dump bytes.
V_ASN1_PRINTABLESTRINGV_ASN1_IA5STRING,
V_ASN1_T61STRING,
V_ASN1_NUMERICSTRING,
V_ASN1_VISIBLESTRING,
V_ASN1_UTF8STRING,
V_ASN1_UTCTIME, and
V_ASN1_GENERALIZEDTIME.ASN1_parse()
is identical to ASN1_parse_dump() with 0 passed as
the dump argument.
These functions return 1 for success or 0 for failure.
In particular, they print an error message to bio, abort parsing and printing, and return 0 when parsing or decoding fails, when a recursive call fails, when encountering a value extending beyond length, or when encountering a nesting level in excess of 128. They also abort parsing and printing and return 0 when any printing operation fails.
ASN1_get_object(3), ASN1_item_d2i(3), ASN1_item_new(3), ASN1_STRING_print(3), ASN1_TYPE_new(3)
ITU-T Recommendation X.690, also known as ISO/IEC 8825-1: Information technology - ASN.1 encoding rules: Specification of Basic Encoding Rules (BER), Canonical Encoding Rules (CER) and Distinguished Encoding Rules (DER), section 8.1: General rules for encoding
ASN1_parse() first appeared in SSLeay
0.5.1 and has been available since OpenBSD 2.4.
ASN1_parse_dump() first appeared in
OpenSSL 0.9.6 and has been available since OpenBSD
2.9.
The content of values tagged as
V_ASN1_BMPSTRING is silently ignored and none of it
is printed.
| December 9, 2021 | openbsd |