Search notes:

Privacy-Enhanced Mail (PEM)

Privacy-Enhanced Mail (PEM) defines a format for storing and exchanging cryptographic keys and certificates.
With PEM, binary data is represented with Base64. The Base64 encoded data is embedded between a starting line and an ending line like so
-----BEGIN label -----
…
-----END label -----.
Commonly found values for label include
A file that contains PEM data typically has one of the following suffixes:

TODO

Generate a file in PEM format

$ openssl genpkey -out the.key -algorithm RSA
$ cat the.key
-----BEGIN PRIVATE KEY-----
MIIEvgIBADANBgkqhkiG9w0BAQEFAASCBKgwggSkAgEAAoIBAQDd+IKR9wyKI5jp
Yy4abfvcuDebil4av4P7qh1qykOZE5L0MYaAL0pXsC7iYu1/dZSGpqiR0xigwDFQ
…
-----END PRIVATE KEY-----

BEGIN RSA PRIVATE KEY

A PEM file that starts with BEGIN RSA PRIVATE KEY is stored in a legacy format.

See also

The Python script get-remote-certificate.py, located in a Python installation under Tools/scripts
PKCS #8

Links

RFC 7468: Textual Encodings of PKIX, PKCS, and CMS Structures.

Index