Public key cryptography
Cryptography with a matched key pair: a public key anyone may use, and a private key only you hold.
In simple terms
Anyone can encrypt to your public key or verify your signature; only the private key can decrypt or sign. The keys are mathematically linked but cannot be derived backwards.
Analogy
A mailbox slot: anyone can drop a letter in, only you with the key can take mail out.
Going deeper
Security rests on trapdoor problems: integer factorisation and discrete logarithms (RSA, DSA) or elliptic-curve discrete logarithms (ECDSA, Ed25519, X25519). A 256-bit elliptic-curve key matches ~128-bit security, so keys stay small enough for phones and certificates.
Common mistake
Public keys are meant to be public — but private keys must never leave secure storage, and "encrypt with the private key" is a myth: signing is a different operation.