Use this when sharing or verifying a public key.
Public Key
A public key is the shareable half of a key pair, published in certificates or authorized_keys. Others use it to encrypt data for the owner or verify the owner's signatures.
1. Public keys can be shared freely.
2. Bind them to identities (certificates, fingerprints).
3. Verify fingerprints out of band.
4. Distribute via trusted channels.
5. Replace when private key is compromised.
private key → public key → shared and bound to identity
Context & applicabilityCommon mistakes · platform/version boundaries
- Trusting a public key received over the same channel as the message (no out-of-band check).
- Accepting changed SSH host keys without investigation.
- Publishing keys without expiry or a revocation path.
- Pinning keys in apps without a backup pin, causing outages on rotation.
Operational reference
Fast context before you go deeper.
openssl x509 -in cert.pem -noout -pubkey | openssl sha256Verification & Troubleshooting
Start with the observed symptom, prove the nearest boundary, and move outward only when the current state is understood.
Use the operational verification above to establish the expected state.
Capture the concrete output, symptom, packet, log or counter before changing anything.
Step 1 Checking a public key Verify boundary
openssl pkey -pubin -in pub.pem -text -noout
ssh-keygen -lf ~/.ssh/id_ed25519.pub # fingerprint
openssl x509 -in cert.pem -noout -pubkey | openssl sha256
Compare fingerprints through a separate channel before trusting a key (SSH first connection, PGP).
Evidence · 1 on this Topic
Expected observations and documentation recipes are reference material. Record actual output, device identity, scope and time before claiming a verified result.
- Public keys can be shared freely.
- Their authenticity must be verified.
- Certificates bind keys to identities.
openssl pkey -in key.pem -pubout -out pub.pem— extract public keyssh-keygen -y -f— /.ssh/id_ed25519~SSH public keyopenssl x509 -in cert.pem -noout -pubkey— from certificate
ReferenceWhy it matters1 section · depth on demand
Distributing public keys
Public keys are not secret, but you must trust that a public key belongs to the right owner:
- Certificates signed by a CA (TLS, S/MIME, VPN).
- SSH
known_hostsandauthorized_keys(trust on first use or SSH certificates). - Key fingerprints verified out of band.
openssl x509 -in cert.pem -pubkey -noout extracts a public key; ssh-keygen -lf key.pub shows its fingerprint.
ReferenceImportant terms & boundaries1 section · depth on demand
In depth
A public key is the shareable half of an asymmetric key pair. Others use it to verify your signatures or to encrypt data (or establish keys) that only your private key can use. Certificates distribute public keys bound to identities.
openssl pkey -in private.pem -pubout -out public.pem
ssh-keygen -y -f ~/.ssh/id_ed25519 > id_ed25519.pub
ssh-keygen -lf id_ed25519.pub # fingerprint
Public keys are not secret, but their authenticity matters: an attacker who substitutes their own public key can impersonate the owner. Verify fingerprints out of band (SSH host keys) or rely on a trusted CA (TLS certificates).
Additional reference context Scope · expected state · examples · history · terminology Open only when you need the supporting context
Verification history & basis
When and against what this Topic was checked. Later text edits do not count as a new check.
Authoritative/upstream documentation reviewed for bounded claims in Asymmetric Cryptography → Public Key. Documentation verification only; this is not observed lab or production Evidence.
Basis: https://csrc.nist.gov/pubs/fips/186-5/final · confidence 94%