wrong tag SSL / TLS Origin: Network OSI layer 6 · Presentation Last updated 18 Nov 2026

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).

Exact message you may see 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
Seen on: OpenSSL SSL

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

  1. file cert.crt to see the format
  2. Convert with -inform DER / pkcs12
  3. Re-download the file

Detailed fix by platform

Shell

  1. bash
    file cert.cer
    openssl x509 -inform DER -in cert.cer -out cert.pem

How to diagnose

  1. Format — PEM/DER/PFX?
  2. -inform — Set?
  3. 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:

Where this error sits

Origin: Network. Errors that are often confused with or caused by this one (click to open):

bad end line — PEM routines: bad end line / no start line — Windows CRLF line endings or truncated PEM file (SSL / TLS)bad end lineca 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 (SSL / TLS)ca md too weak / ee k…Django — Django send_mail: ssl.SSLError: [SSL: WRONG_VERSION_NUMBER] (EMAIL_USE_SSL vs EMAIL_USE_TLS on the wrong port) (Email / SMTP)DjangoERR_OSSL_EVP_UNSUPPORTED — Error: error:0308010C:digital envelope routines::unsupported (Node.js)ERR_OSSL_EVP_UNSUPPOR…error 26 — openssl verify error:num=26:unsupported certificate purpose (SSL / TLS)error 26error 9 — openssl verify error:num=9:certificate is not yet valid (SSL / TLS)error 9Heartbleed — Heartbleed (CVE-2014-0160): OpenSSL heartbeat extension vulnerable (SSL / TLS)Heartbleedno start line — OpenSSL: unable to load certificate / PEM routines:get_name:no start line (key values mismatch) (SSL / TLS)no start linewrong tag

Explore the map of this error Full error map →

🧠 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.