Sortix cross-nightly manual
This manual documents Sortix cross-nightly. You can instead view this document in the latest official manual.
NAME
ASN1_get_object — parse identifier and length octetsSYNOPSIS
#include <openssl/asn1.h>ASN1_get_object(const unsigned char **ber_in, long *plength, int *ptag, int *pclass, long omax);
DESCRIPTION
ASN1_get_object() parses the identifier and length octets of a BER-encoded value. On function entry, *ber_in is expected to point to the first identifier octet. If the identifier and length octets turn out to be valid, the function advances *ber_in to the first content octet before returning.RETURN VALUES
Bits set in the return value of ASN1_get_object() have the following meanings:- 0x80
- An error occurred. One of the ERRORS described below has been set.
- 0x20 = V_ASN1_CONSTRUCTED
- The encoding is constructed rather than primitive, and the identifier and length octets are valid.
- 0x01
- The length octet indicates the indefinite form. This bit can only occur if V_ASN1_CONSTRUCTED is also set.
- 0x00
- A valid primitive encoding.
- 0x20
- A valid constructed encoding, definite form.
- 0x21
- A valid constructed encoding, indefinite form.
- 0x80
- Either a primitive encoding with a valid tag and definite length, but the content octets won't fit into omax, or parsing failed. Use ERR_GET_REASON(3) to distinguish the two cases.
- 0xa0
- A constructed encoding with a valid tag and definite length, but the content octets won't fit into omax.
ERRORS
If the bit 0x80 is set in the return value, diagnostics can be retrieved with ERR_get_error(3), ERR_GET_REASON(3), and ERR_reason_error_string(3):- ASN1_R_HEADER_TOO_LONG “header too long”
-
Inspecting omax bytes was insufficient to finish parsing, the tag number encoded in the identifier octets exceeds INT_MAX, the number encoded in the length octets exceeds LONG_MAX, or using the indefinite form for the length octets is attempted even though the encoding is primitive.
- ASN1_R_TOO_LONG “too long”
-
The identifier and length octets are valid, but the content octets won't fit into omax. The following have been set as appropriate and can safely be inspected: *pclass, *ptag, *plength, and the bits V_ASN1_CONSTRUCTED and 0x01 in the return value. The parse pointer *ber_in has been advanced to the first content octet.
STANDARDS
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.2: Identifier octets
- Section 8.1.3: Length octets