fjordtools / Errors / PEM routines: no start line

error:0480006C:PEM routines::no start line

A PEM file is Base64 text between a line that starts with -----BEGIN and a matching END line. The tool read the file, found no BEGIN line and stopped. The usual causes are a header that was cut off or glued to the data, a binary DER file, and a web page saved in place of the key.

Fjordtools team · Seen in OpenSSL, Node and Python · Published · 2 min read

How the tools word it

OpenSSL 3.6 asn1parseerror:0480006C:PEM routines:get_name:no start line:crypto/pem/pem_lib.c:794:
Node 26 X509Certificateerror:0480006C:PEM routines::no start line (ERR_OSSL_PEM_NO_START_LINE)
Python 3.14 sslValueError: Invalid PEM encoding; must start with -----BEGIN CERTIFICATE-----

Common causes

  1. The BEGIN line is missing

    Only the Base64 lines were copied. Without the BEGIN line there is nothing that says what the data is.

    Input

    MC4CAQAwBQYDK2VwBCIEIAvXQSzkUXiBUvR8YJRi5koamd18fdoiwoI7BD04DB1Z

    Key Inspector says

    No key found. Paste a PEM block (-----BEGIN …), a JWK or JWKS, or an OpenSSH key
  2. The header and the data are on one line

    A key pasted into a form or a config file can lose the line break after the BEGIN line. The BEGIN line must be on a line of its own, and OpenSSL finds no start line when the data follows it directly.

    Input

    -----BEGIN PRIVATE KEY-----MC4CAQAwBQYDK2VwBCIEIAvXQSzkUXiBUvR8YJRi5koamd18fdoiwoI7BD04DB1Z
    -----END PRIVATE KEY-----

    Key Inspector says

    No key found. Paste a PEM block (-----BEGIN …), a JWK or JWKS, or an OpenSSH key
  3. A web page instead of the file

    A download that was redirected, or a link to a login page, saves HTML under the name of the file.

    Input

    <!DOCTYPE html>
    <title>Sign in</title>

    Key Inspector says

    No key found. Paste a PEM block (-----BEGIN …), a JWK or JWKS, or an OpenSSH key
  4. A binary DER file

    A file with the extension .der, .cer or .key can hold the raw bytes instead of PEM text. A PEM reader finds no BEGIN line in it. Tell the tool to read DER, for example openssl pkey -inform DER -in key.der. Opened in a text editor it looks like noise.

  5. Text before the key is not the problem

    Notes above the BEGIN line and Windows line endings are accepted. If the BEGIN line is there, this error is about something else.

    Input

    Here is my key:
    -----BEGIN PRIVATE KEY-----
    MC4CAQAwBQYDK2VwBCIEIAvXQSzkUXiBUvR8YJRi5koamd18fdoiwoI7BD04DB1Z
    -----END PRIVATE KEY-----
    

    Key Inspector says

    Ed25519 private key · PKCS#8 PEM

How to fix it

  1. Make sure the first line is -----BEGIN followed by a label such as PRIVATE KEY, with five dashes at both ends, and that the END line matches it.
  2. Put the BEGIN line, the Base64 lines and the END line on separate lines.
  3. Open the file in a text editor. If it is HTML, download it again and follow redirects (curl -L).
  4. If the file is binary, add the DER input format to the command (for example -inform DER), or convert it to PEM first.
  5. Paste the text into the Key Inspector. It tells you at once whether a key is found.

Related errors

More error explainers are coming

See all errors.