OpenSSL: asn1 encoding routines: wrong tag / not enough data — certificate or key is DER or PFX, not PEM
OpenSSL tried to read a file in the wrong format (PEM vs DER vs PKCS#12).
asn1 encoding routines:asn1_check_tlen:wrong tagerror:0D0680A8:asn1 encoding routines:asn1_check_tlen:wrong tagASN1_item_d2i_fp:nested asn1 errorerror:0D07803A:asn1 encoding routines:asn1_item_embed_d2i:nested asn1 errornot enough data Meaning
Identify the real format (file cert.crt, head -c 20), then convert: openssl x509 -inform DER -in cert.cer -out cert.pem, openssl pkcs12 -in x.pfx -nodes. Add -inform DER for binary certificates and -keyform for keys.
Common causes
- Binary DER file read as PEM
- PFX/P12 passed as a certificate
- Key format (PKCS#1 vs PKCS#8) mixed up
- Corrupted/partial download
- Wrong file selected
⚡ Quick fix
file cert.crtto see the format- Convert with
-inform DER/pkcs12 - Re-download the file
Detailed fix by platform
Shell
- bash
file cert.cer openssl x509 -inform DER -in cert.cer -out cert.pem
How to diagnose
- Format — PEM/DER/PFX?
- -inform — Set?
- File — Intact?
🔧 Still not fixed?
Many errors look alike. If the steps above didn’t solve it, one of these is probably what you’re facing:
Similar errors
- bad end line PEM routines: bad end line / no start line — Windows CRLF line endings or truncated PEM file
- ca md too weak / ee key too small OpenSSL: error:0A00018E:SSL routines::ca md too weak / error:140AB18F:SSL routines:SSL_CTX_use_certificate:ee key too small
- Django Django send_mail: ssl.SSLError: [SSL: WRONG_VERSION_NUMBER] (EMAIL_USE_SSL vs EMAIL_USE_TLS on the wrong port)
Most viewed in SSL / TLS
- HTTPSConnectionPool: Max retries exceeded (SSLError) Python requests: HTTPSConnectionPool(host='api.example.com', port=443): Max retries exceeded with url: /v1 (Caused by SSLError(SSLCertVerificationError(1, '[SSL: CERTIFICATE_VERIFY_FAILED] ...')))
- DST Root CA X3 expired (old clients fail) Old clients: certificate has expired — Let's Encrypt chain uses expired DST Root CA X3 (OpenSSL 1.0.x, Android < 7.1.1)
- Keystore was tampered with, or password was incorrect Java keytool: java.io.IOException: Keystore was tampered with, or password was incorrect
Other ways to find it
Where this error sits
Origin: Network. Errors that are often confused with or caused by this one (click to open):
🧠 Still stuck? Analyze your error
Paste the full message, response headers or stack trace — we'll detect the platform and point to the most likely cause.
💬 What worked for others
No tips yet — did something else fix this for you?
Share what worked for you
Tips are checked by an editor before they appear. Links are removed.
Report a correction or suggest an improvement
Last updated 18 Nov 2026