OpenSSL: unable to load certificate / PEM routines:get_name:no start line (key values mismatch)
OpenSSL (or Nginx/Apache) couldn’t read the certificate or key — wrong file format, wrong file, or the key doesn’t match the certificate.
no start linePEM routines:get_name:no start lineunable to load certificatekey values mismatchSSL_CTX_use_PrivateKey_file failed Meaning
PEM files must contain -----BEGIN CERTIFICATE----- / -----BEGIN PRIVATE KEY----- blocks. DER/PFX files, Windows line endings, BOMs, copied text with extra spaces, or swapping cert and key cause “no start line”. “key values mismatch” means the key belongs to another certificate.
Common causes
- File is DER/PFX, not PEM
- Cert and key paths swapped
- Extra characters/BOM or missing BEGIN line
- Private key from a different CSR (key values mismatch)
⚡ Quick fix
- Convert formats (openssl x509 -inform der / openssl pkcs12)
- Check the first line of each file
- Compare cert and key modulus/public key hashes
Detailed fix by platform
Shell
- bash
head -1 cert.pem key.pem openssl x509 -inform der -in cert.cer -out cert.pem openssl x509 -noout -pubkey -in cert.pem | sha256sum; openssl pkey -pubout -in key.pem | sha256sum
How to diagnose
- Format — BEGIN line present?
- Match — Public key hashes equal?
- Paths — ssl_certificate vs ssl_certificate_key
🔧 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
- 526 Cloudflare Error 526: Invalid SSL Certificate
- 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
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] ...')))
- SSLCertificateFile: file does not exist Apache: AH02240: Server should be SSL-aware but has no certificate configured / SSLCertificateFile: file '/etc/ssl/x.crt' does not exist or is empty
- 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)
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 13 Oct 2026