Cryptography › Module 2 › Lesson 2
Asymmetric Encryption (RSA)
Public/private key pairs: encrypt with one key, decrypt with the other
Opening
Publish a lock, keep the key
RSA (and modern ECC alternatives) let you publish a public key while keeping a private key secret. Anyone can encrypt to you; only you decrypt. Or you sign with private; anyone verifies with public. That solves the “how do we share AES keys?” problem—at the cost of more math and slower operations.
1. Public vs Private
Public key
Can be shared. Used to encrypt to the owner or verify signatures.
Private key
Must stay secret. Decrypts or creates signatures.
Hybrid systems
TLS often uses asymmetric crypto to agree on a symmetric session key, then AES for bulk data.
2. Mental Model
Think of a padlock anyone can snap shut (public) but only you can open (private). Digital signatures flip the metaphor: only you can stamp a seal; everyone can check it against your published stamp pattern.
Generate an RSA key pair with OpenSSL (lab)openssl genrsa -out private.pem 2048 openssl rsa -in private.pem -pubout -out public.pem openssl rsa -in private.pem -text -noout | more
openssl genrsa -out private.pem 2048 openssl rsa -in private.pem -pubout -out public.pem openssl rsa -in private.pem -text -noout | more
Key size & algorithm choice
2048-bit RSA is a common legacy baseline; newer designs often prefer elliptic-curve algorithms. Follow current guidance for your stack.
Knowledge Check
In asymmetric encryption, the private key should be:
Multiple choice
Knowledge Check
True or False: TLS often combines asymmetric key exchange with symmetric bulk encryption.
True or False
Knowledge Check
A public key is typically used to:
Multiple choice