Skip to content

Main content

BER Tag First Octet From Fields Tool

Compute ber tag first octet from fields from explicit bounded inputs.

Loading tool…

Description

Return octet = tagClass*64+(constructed ? 32 : 0)+tagNumber.

ASN.1 BER encodes values as identifiers, lengths and content; DER constrains representation to a canonical form. Content octets, first-tag octets and length prefixes are only parts of a complete encoded value.

Return octet = tagClass*64+(constructed ? 32 : 0)+tagNumber.

When to use this tool

Use BER Tag First Octet From Fields when inspecting one explicit ASN.1 encoding component.

How to use the tool and how it works

  1. Enter tagClass, constructed, tagNumber. Use the units and conventions below.
  2. Run the tool. Correct any format, range, or cross-field input error before interpreting the output.
  3. Read octet. Use the output convention below.

Require whole tagClass in [0,3] and tagNumber in [0,31]. Return octet = tagClass*64+(constructed ? 32 : 0)+tagNumber.1

ASN.1 encodings distinguish identifier, length and content octets. DER adds canonical constraints; the local output still needs its surrounding encoding.2

Input fieldMeaning and unitsAccepted input
tagClassTag ClassRequired. Safe integer; minimum 0; maximum 3.
constructedConstructedRequired. Boolean.
tagNumberFirst-octet low field; 31 denotes high-tag-number form requiring following octets.Required. Safe integer; minimum 0; maximum 31.
Output fieldInterpretationReturned shape
octetOctetRequired. Safe integer.
json
{
  "input": {
    "tagClass": 0,
    "constructed": true,
    "tagNumber": 16
  },
  "output": {
    "octet": 48
  }
}

Limitations and assumptions

  • At tagNumber 31 the byte is a high-tag-number marker and needs following tag-number octets. Class labels, complete tags, lengths and content are not inferred.
  • Inputs must satisfy both the field types and the cross-field conditions above. Invalid input causes an error; a successful false flag or documented placeholder is a different result.
  • Numeric calculations use binary floating point unless exact decimal-integer arithmetic is explicitly stated. No hidden measurement tolerance or decimal rounding is added; nonfinite or out-of-contract results are rejected. Numeric signed-zero results are exported as zero.

Alternative or Complementary methods

Use an appropriate complete ASN.1 encoder and schema for canonical full values, nested lengths and application semantics.

References

  1. Calculation and input contract: encode/ber-tag-first-octet-from-fields — tool.io

  2. ASN.1 encoding rules: ITU-T X.690 (12/1997) — International Telecommunication Union

Similar or alternative tools