---
id: "pem_public_key"
kind: "datatype"
status: "draft"
is_pii: false
categories: ["cryptography"]
langs: ["common"]
quality: 68
url: "http://registry.apicrafter.io/datatype/pem_public_key"
---

# Public key (PEM) (`pem_public_key`)

> **Draft.** Draft records have not been reviewed yet and may be incomplete or wrong; do not treat them as authoritative for legal or compliance decisions.

Public key in the PEM textual encoding: the Base64 of a DER SubjectPublicKeyInfo structure (RFC 5280) between -----BEGIN PUBLIC KEY----- and -----END PUBLIC KEY----- (RFC 7468, section 13). OpenSSL also writes RSA keys in the PKCS #1 form with the label RSA PUBLIC KEY. A public key is not secret; for the private key see x509_private_key.

- Personal data (PII): no
- Categories: Cryptographic identifiers (cryptography)
- Countries: global
- Languages: Common to most languages (common)

## Detection

Regular expression (Python `re`):

```
^-----BEGIN (?:RSA )?PUBLIC KEY-----[\s\S]+-----END (?:RSA )?PUBLIC KEY-----$
```

## Examples

- `-----BEGIN PUBLIC KEY-----
MHYwEAYHKoZIzj0CAQYFK4EEACIDYgAEn1LlwLN/KBYQRVH6HfIMTzfEqJOVztLe
kLchp2hi78cCaMY81FBlYs8J9l7krc+M4aBeCGYFjba+hiXttJWPL7ydlE+5UG4U
Nkn3Eos8EiZByi9DVsyfy9eejh+8AXgp
-----END PUBLIC KEY-----` — Example P-384 key of RFC 7468, section 13
- `-----BEGIN PGP PUBLIC KEY BLOCK-----

xjMEU/NfCxYJKwYBBAHaRw8BAQdAPwmJlL3ZFu1AUxl5NOSofIBzOhKA1i+AEJku
Q+47JAY=
-----END PGP PUBLIC KEY BLOCK-----` (invalid example) — OpenPGP public key block

## Sources

- doc: <https://www.rfc-editor.org/rfc/rfc7468#section-13>
- wikipedia: <https://en.wikipedia.org/wiki/Privacy-Enhanced_Mail>

## Quality

Score 68/100. Missing: second example, mapping (Wikidata, Schema.org, ...), translation, detector coverage.

JSON: <http://registry.apicrafter.io/api/v1/datatypes/pem_public_key.json> · Edit: <https://github.com/apicrafter/metacrafter-registry/edit/main/data/datatypes/any/cryptography/pem_public_key.yaml>
