Error message
error:0680009B:asn1 encoding routines:ASN1_get_object:too long
Reproduced on OpenSSL 3.6; version 1.1.x phrased it "asn1 encoding routines:ASN1_get_object:header too long" (error:0D07207B) — the widely-searched wording. Both mean the same parse failure.
What it means
The DER parser read what should be an ASN.1 tag-length header and got a length that exceeds the data available — the classic signature of "these bytes are not DER". Usually the input is base64 text, PEM, or truncated data being parsed as raw DER, not a subtly broken structure.
Why it happens
Base64/PEM text parsed as binary DER
commonASCII characters interpreted as tag/length bytes produce absurd lengths immediately. Passing -inform der while the file is PEM (or piping base64 without decoding) is the textbook trigger.
Truncated DER
commonA download cut short, a database column limit, or copy-paste losing trailing bytes leaves a header announcing more content than exists. The outer SEQUENCE length no longer matches the file size.
Concatenated or offset data
occasionalExtra bytes before the real structure (a length prefix from another protocol, HTTP headers saved into the file) shift the parser into mid-structure bytes that read as an invalid header.
How to fix it
- 1.
Match the input format to the parser
Decode base64 first, or tell the tool it is PEM. asn1parse defaults to PEM input; -inform der is only for actual binary.
bash # base64 signature/blob → DER, then parse openssl base64 -d -in sig.b64 | openssl asn1parse -inform der # PEM object: let asn1parse handle the armor itself openssl asn1parse -in cert.pem - 2.
Check sizes before parsing
For an ECDSA P-256 DER signature expect ~70–72 bytes starting with 0x30. A 96-byte "signature" is probably base64; 64 bytes is raw r‖s, which is not DER at all.
bash wc -c < sig.der head -c 8 sig.der | xxd # 30 44/45/46 ... → DER SEQUENCE - 3.
If it is a raw r‖s signature, convert it
JWS and WebCrypto emit 64-byte raw ECDSA signatures that no DER parser will accept. The converter below turns raw into DER (and back) and shows the r and s integers — paste the bytes and see which format you actually hold.