← Cryptography guide

K095 / Encoding and decoding

ASN.1 DER

ASN.1 DER BER encoding · Survey date 2026-12-05

DER is a subset of BER that restricts its flexibility, providing ASN.1 binary encoding rules.

CRYPTOGRAPHY LAB / K095

Cryptography Lab · ASN.1 DER

Run real computations and inspect intermediate states step by step.

Educational only. Never enter real passwords or secret keys. Computation stays in your browser; input and trace values are not sent to a server. Do not use this implementation in production.

Scope: Limited implementation

DER (OCTET STRING, short-form length)

See the scope above for fixed examples, reduced parameters and supported variants. Standard operation names and formulas are retained.

Reference ↗

Open lab →

Definition and overview
DER is a subset of BER that restricts its flexibility, providing ASN.1 binary encoding rules. Source document ↗
Classification and reversibility
Encoding rules permitting decoding and re-encoding; DER permits one encoding per message. Source document ↗
Key or secret requirements
Not confirmed in the survey
Operating principle and structure
BER family uses Tag-Length-Value (TLV) in order. Source document ↗
Key size, block size and parameters
Not confirmed in the survey
Security strength and recommendation
Not confirmed in the survey
Known attacks and vulnerabilities
A pyasn1 BER/CER/DER decoder DoS involving unbounded long-form tag accumulation and excessive CPU cost was reported. Source document ↗
Standards and certification
ITU-T X.690 defines BER, CER and DER rules. Source document ↗
Typical uses
DER is common in security applications such as X.509 certificates. Source document ↗
Implementations, libraries and tools
Python pyasn1 provides BER/CER/DER codecs. Source document ↗
Decryption or decoding
BER decoders can decode DER, but DER decoders cannot necessarily decode all BER. Source document ↗
Advantages
Unique encoding for the same value aids comparison and signature verification. Source document ↗
Limitations and cautions
ASN.1 expressiveness and flexibility make safe DER parsing a practical security challenge. Source document ↗
Distinguishing encryption, encoding and hashing
Not confirmed in the survey

Practical examples

Examples are illustrative; they are not execution-tested implementations or operational recommendations.

Example

Serialize an ASN.1-defined structure, such as integer/string fields, into DER TLV bytes. Parse it back with a BER/DER decoder; useful in X.509 exchange.

Procedure

Map values to an ASN.1 schema, serialize TLV under DER rules and store/send bytes. Decode by parsing with BER/DER codec and reconstructing schema types. No encryption keys or secrets are involved.

Scenario

Serialize ASN.1 for X.509 certificates/CSRs, signature structures or SNMP and validate parsed fields. Security protocols use canonical encodings for consistent signed bytes.

Pitfalls and alternatives

Not encryption. Avoid mixing BER and DER, noncanonical BER re-encoding differences and unbounded length/tag parsing of untrusted input. Use current ASN.1 libraries.

References