LinuxCommandLibrary

asn1parse.1s

Parse and display ASN.1 structures

SYNOPSIS

openssl asn1parse [-inform PEM|DER] [-in filename] [-out filename] [-noout] [-offset number] [-length number] [-dump] [-dlimit number] [-i] [-oid file] [-strparse offset] [-genstr string] [-f filename] [-check]

PARAMETERS

-inform PEM|DER
    Specify the input format; PEM (default) or DER.

-in filename
    The input file to parse.

-out filename
    The output file to write the parsed ASN.1 structure to.

-noout
    Do not output the parsed ASN.1 structure.

-offset number
    Start parsing at the specified offset within the input data.

-length number
    Parse only the specified number of bytes from the input data.

-dump
    Dump the raw ASN.1 data as hexadecimal.

-dlimit number
    Set the dump limit in bytes.

-i
    Print out the indefinite form.

-oid file
    Load the given file for extra object ID definitions.

-strparse offset
    Parse a string at the specified offset.

-genstr string
    Generate a string from the string.

-f filename
    ASN1 structure format file.

-check
    Check file for format violations

DESCRIPTION

The `asn1parse` command is a command-line utility for parsing ASN.1 (Abstract Syntax Notation One) structures. It allows you to examine the content of ASN.1 encoded data, which is commonly used in cryptography, networking, and telecommunications. `asn1parse` can read ASN.1 data from a file or standard input, and it will display the structure of the data in a human-readable format. This includes displaying the tag, length, and value of each element in the ASN.1 structure. It is particularly useful for debugging and analyzing X.509 certificates, PKCS#7/CMS messages, and other ASN.1 based data formats. The command utilizes OpenSSL libraries for its ASN.1 parsing capabilities. It can be used to quickly verify if an ASN.1 structure is valid or to inspect the details of its content.

EXAMPLES

Example 1: Parse an X.509 certificate in PEM format:
openssl asn1parse -in certificate.pem

Example 2: Parse a DER-encoded certificate:
openssl asn1parse -inform DER -in certificate.der

Example 3: Dump the raw ASN.1 data:
openssl asn1parse -in certificate.pem -dump

SEE ALSO

openssl(1)

Copied to clipboard