Skip to content

Public Key

Medium — good to knowSecurity

ELI5 — The Vibe Check

A public key is like your open mailbox — anyone can drop a message in it (encrypt data with it), but only you have the key to open the box and read it (your private key). You can share your public key with literally everyone; it's designed to be public.

Real Talk

In asymmetric cryptography, the public key is the non-secret half of a key pair. It's used to encrypt data (that only the private key can decrypt) or to verify digital signatures (created by the private key). RSA and ECC are common public-key algorithms.

Show Me The Code

# Generate RSA key pair
openssl genrsa -out private.pem 2048
openssl rsa -in private.pem -pubout -out public.pem

# Encrypt with public key
openssl rsautl -encrypt -pubin -inkey public.pem \
  -in message.txt -out message.enc

When You'll Hear This

"Share your public key with the CI system for deployment." / "The public key is in your ~/.ssh/id_rsa.pub file."

Made with passive-aggressive love by manoga.digital. Powered by Claude.