Error message
error:0680009B:asn1 encoding routines:ASN1_get_object:too long
Reproduced on OpenSSL 3.6; OpenSSL 1.1.x prints the same failure as "error:0D07209B:asn1 encoding routines:ASN1_get_object:too long". The widely searched "header too long" (error:0680007B on OpenSSL 3, error:0D07207B on 1.1.x) is a sibling: the input ends before the tag-and-length header itself is complete — an empty or one-byte file, or a header cut off mid-length.
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 — HTTP headers saved into the file, another protocol's framing — shift the parser into bytes that read as an invalid header, reported as this error or as its sibling "header too long" depending on the bytes. A short length prefix can also misparse silently: asn1parse then prints a nonsense first line instead of failing.
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.