K095 / Encoding and decoding
ASN.1 DER
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.
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.Output
Previous state
- 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
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
- ASN.1 Distinguished Encoding Rules (DER) | ASN.1 Quick Reference | OSS Nokalva ↗
- ASN.1 Basic Encoding Rules (BER) - A Simple Explanation with Examples ↗
- CVE-2026-59884 - Red Hat Customer Portal ↗
- Recommendation ITU-T X.690 - Information technology - ASN.1 encoding rules: Specification of Basic Encoding Rules (BER), Canonical Encoding Rules (CER) and Distinguished Encoding Rules (DER) ↗
- pyasn1 v0.6.1 ↗
- ASN.1 FAQ ↗
- ASN1*: Provably Correct, Non-malleable Parsing for ASN.1 DER ↗