Maaz Zindani

Loading the index…

↑↓ move↵ openesc close4072 pages
Security and hardening

OpenSSL cannot read my certificate: PEM routines, no start line

Errorerror:0909006C:PEM routines:get_name:no start line

Short answer

OpenSSL looked for a PEM block of one type and did not find it. The file is usually binary DER, not text, or its BEGIN line names another type or is malformed. Check the first line of the file. Convert DER with -inform DER, or fix the BEGIN and END lines.

  • Applies to OpenSSL 3.0, Ubuntu 24.04
  • Updated
  • By Maaz Zindani, Senior Software Engineer

Fix it fast

  1. 1Find out which cause you have

    Look at the first line of the file. A PEM certificate starts with a line of text; a DER file is binary and prints garbage.

    head -c 80 server.cer; echo
  2. 2Match what you see, then jump to its fix

    1. 1The first line is unreadable binary characters, typical for .cer or .der files exported from Windows or a browser.The file is DER (binary), not PEMFix
    2. 2The file is text, but the label after BEGIN is not CERTIFICATE (for example a private key given to a certificate command), or the dashes or spacing are damaged.The BEGIN line is wrong for the object the command expectsFix

What does the error look like?

  • error:0909006C:PEM routines:get_name:no start line
  • Expecting: TRUSTED CERTIFICATE
  • PEM_read_bio:no start line

Cause 1 of 2

The file is DER (binary), not PEM

1Check

DER is a binary encoding, while PEM is base-64 text between marker lines. Try reading the file as DER.

openssl x509 -inform DER -in server.cer -noout -subject

2Fix

Convert it to PEM and use the converted file everywhere.

openssl x509 -inform DER -in server.cer -outform PEM -out server.pem

3Verify

The PEM file now starts with a BEGIN CERTIFICATE line and prints its details.

head -n 1 server.pem
openssl x509 -in server.pem -noout -subject -dates

Confirmed by docs.openssl.org

Did this fix it?

Cause 2 of 2

The BEGIN line is wrong for the object the command expects

1Check

A PEM block is delimited by lines with exactly five hyphens, the label in capitals and one space after BEGIN or END. The label must match the object the command wants. Text before the BEGIN line is ignored, so only the lines themselves matter.

grep -n -E "^-----(BEGIN|END)" server.pem

2Fix

Use the file that holds the certificate, or repair the marker lines so they read exactly BEGIN CERTIFICATE and END CERTIFICATE with five hyphens each. Pasting through an editor that trims or wraps lines is a common way to damage them.

-----BEGIN CERTIFICATE-----
(base-64 lines)
-----END CERTIFICATE-----

3Verify

OpenSSL parses the file and prints the subject.

openssl x509 -in server.pem -noout -subject

Confirmed by rfc-editor.org

Did this fix it?

How do I stop it coming back?

  • Name files by format when you export them: .pem for text, .der for binary.
  • Move certificates between machines as files, not by pasting them into chat or e-mail clients that rewrap lines.
  • Run openssl x509 -noout -subject on a certificate as soon as you receive it.

Sources

How was this page made?

I drafted this page with AI assistance from the official documents listed under Sources. Every cause above names the document that confirms it. I have not reproduced this fix on a machine of my own yet, so read it as documented guidance, not a test report. Found a mistake? Tell me.

Which stack is behind this page?

Related fixes

Next step

Want this handled for good?

I look after servers, apps and releases end to end. Tell me what keeps breaking.