Public-key cryptography uses related keypairs instead of one shared secret. Anyone may publish a public key, while its matching private key remains secret. A sender encrypts to the recipient’s public key; only the private-key holder can decrypt. The same asymmetric foundation also supports digital signatures, where verification is public but forgery is intended to be infeasible. section 8.0 section 8.1
Alice and Bob exchange a message
Alice generates a keypair and publishes her public key. Bob encrypts his plaintext with that public key and sends the ciphertext over an insecure channel. An eavesdropper can obtain the public key and ciphertext, but decryption requires Alice’s private key. The lock-and-key analogy captures the division: the public key is the lock, and the private key is the matching physical key. section 8.1
The security goal depends on trapdoor one-way functions: reversing the operation should be hard without the trapdoor key. Classical systems commonly rely on the difficulty of integer factorization or the discrete logarithm problem. Engineering details matter: weak randomness has caused RSA keys to share primes, deterministic textbook RSA requires probabilistic padding, and small private exponents enable attacks. section 8.3 section 8.5
Practical rules follow directly from the failure modes:
- Keep private keys secret; publishing the corresponding public keys is compatible with confidentiality. section 8.1
- Use probabilistic padding rather than deterministic textbook RSA. section 8.5
- Use reliable randomness and test RSA public moduli with batch GCD to find shared factors. section 8.5
Figure 8.2 Alice and Bob communicating using asymmetric encryption
A sequence diagram makes the public-key exchange, insecure channel, and private-key decryption roles concrete. section 8.1




