Skip to content

Main content

DER Integer Sign Padding Octet Tool

Compute der integer sign padding octet from explicit bounded inputs.

Loading tool…

Description

Canonicalize an unsigned magnitude’s positive DER INTEGER content and add a sign-protection octet when needed.

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.

Canonicalize an unsigned magnitude’s positive DER INTEGER content and add a sign-protection octet when needed.

When to use this tool

Use DER Integer Sign Padding Octet when inspecting one explicit ASN.1 encoding component.

How to use the tool and how it works

  1. Enter unsignedBytes. 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 bytes, added. Inspect added before interpreting the associated values.

Require a nonempty unsignedBytes array whose values are in [0,255]. Remove leading zero octets, preserving one zero for an all-zero value. Prepend zero if the first retained byte has its high bit set; added records whether that sign-protection octet was inserted.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
unsignedBytesNonempty unsigned magnitude octets; leading zero octets are removed before sign protection.Required. Array of safe integer; maximum items 256.
Output fieldInterpretationReturned shape
bytesBytesRequired. Array of safe integer; maximum items 256.
addedAddedRequired. Boolean.
json
{
  "input": {
    "unsignedBytes": [
      128
    ]
  },
  "output": {
    "bytes": [
      0,
      128
    ],
    "added": true
  }
}

Limitations and assumptions

  • This creates positive INTEGER content octets, not a complete DER tag-length-value. Inputs describe unsigned magnitude; integer item validation follows the declared schema and no negative integer encoding is performed.
  • 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.

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/der-integer-sign-padding-octet — tool.io

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

Similar or alternative tools