public key cryptography is great, doesnt need you to share a secret to begin with. public cryptography alone is not secure against man in the middle attackers mallory can intercept and stop, replay, etc, messages scenario: alice wants to send a message to bob alice asks bob for his public key bob sends his public key to alice alice encrypts her message with bob’s public key and sends it to bob
mallory can mitm and provide her public key instead
trust on first use: the first time you communicate, trust the public key that is used and warn the user if it changes in the future
- used in ssh and a couple other protocols
- idea: attacks are not frequent, so assume that you aren’t being attacked the first time you communicate
- also known as “leap of faith”
certificate: a signed endorsement of someone’s public key
- a certificate contains at least two things: the identity of the person, and the key
- notatio:
- encryption under a public key PK: {“Message”}PK
- Signing with a private key SK: {“Message”}SK
- Scenario: Alice wants bob’s public key. Alice trusts Chao(PKc, SKc)
- Chao is our trust anchor
- if we trust PKc, a certificate would trust is {“Bob’s public key is PKs”}SKc
IDEA: make a central, trusted directory, from where you can fetch anyone’s public key. the TD has a public / private keypair PKtd, SKtd directory publishes public key PKtd so that everyone knows it, basked into computers, phones, OS, etc
When you request Bob’s public key, the directory sends a certificate for bob’s public key
adressing scalability: hierarchical trust the roots of trust may delegate trust and signing power to other authorities we still have a root CA which delegates that trust e.g. BC is root ca chao and jian receive delegated trust ( intermediate cas ) M’s identity can be trusted
adressin scalability: multiple trust anchors there are 150 root CAs
if a certificate authority messes up and issues a bad certificate, that sucks cas will push out a list of certificate needs to be revoked.
each certificate has a expiration date when the certificate expires, request a new certificate from the certificate authority the bad certificate will eventually become invalid once it expires benefits: mitigates damage: eventually the bad cert becomes harmless drawbacks: adds management burden: everybody has to renew their certs frequently if someone forgets to renew a cert their website might stop working
tradeoff: how oftenshould certificates be renewed? frequent renewal? more secure, less usable infrequent renewal: less secure, more usable.
summary: certificates certificates: a signed attestation of identity trusted directory: one server holds all the keys, and everyone has the trusted directory’s public key not scalable: doesnt work for billions of keys single point of failure: if the TD is hacked or is down, cryptography is broken certificate authorities: delegated trust from a pool of multiple root CAs root CAs can sign certificates for intermediate CAs revocation: certificates contain an expiration date revocation: CAs sign a list of revoked certificates.
password hashing
for each user store a hash of their password verification process: hash the password submitted by the user check if it matches the password hash in the file
what properties needed? deterministic one way
we can use salts to make sure hashing password123 twice for 2 users doesnt wind up w same values
we can also use slower hashes cryptographic hashes are usually designed to be fast sha is designed