105
CSE 127: Computer Security Asymmetric Crypto, TLS, PKI and CT Deian Stefan Adopted slides from Kirill Levchenko and Dan Boneh

CSE 127: Computer Security Asymmetric Crypto, TLS, PKI …dstefan/cse127-winter19/slides/lecture16.pdfKey Verification • Alice and Bob need a way to know that each has the real public

  • Upload
    others

  • View
    2

  • Download
    0

Embed Size (px)

Citation preview

Page 1: CSE 127: Computer Security Asymmetric Crypto, TLS, PKI …dstefan/cse127-winter19/slides/lecture16.pdfKey Verification • Alice and Bob need a way to know that each has the real public

CSE 127: Computer Security

Asymmetric Crypto, TLS, PKI and CT

Deian Stefan

Adopted slides from Kirill Levchenko and Dan Boneh

Page 2: CSE 127: Computer Security Asymmetric Crypto, TLS, PKI …dstefan/cse127-winter19/slides/lecture16.pdfKey Verification • Alice and Bob need a way to know that each has the real public

Asymmetric Cryptography

• Also called public key cryptography

• Two separate keys ➤ Public key: known to everyone

➤ Private key: used to decrypt and sign

Page 3: CSE 127: Computer Security Asymmetric Crypto, TLS, PKI …dstefan/cse127-winter19/slides/lecture16.pdfKey Verification • Alice and Bob need a way to know that each has the real public

Asymmetric Primitives

• Encryption and decryption

• Signing and verification

• Diffie Hellman key exchange

Page 4: CSE 127: Computer Security Asymmetric Crypto, TLS, PKI …dstefan/cse127-winter19/slides/lecture16.pdfKey Verification • Alice and Bob need a way to know that each has the real public

Asymmetric Keys• Each user has a public and private key

• Keys related to each other in algorithm-dependent way ➤ Need a key generation function

➤ Keygen(r) = (pk, sk) ➤ pk: public key

➤ sk: secret key

➤ r: random bits

Page 5: CSE 127: Computer Security Asymmetric Crypto, TLS, PKI …dstefan/cse127-winter19/slides/lecture16.pdfKey Verification • Alice and Bob need a way to know that each has the real public

Public-key encryption

• Encryption: (public key, plaintext) → ciphertext ➤ Epk(m) = c

• Decryption: (secret key, ciphertext) → plaintext ➤ Dsk(c) = m

Em c

pkDc m

sk

Page 6: CSE 127: Computer Security Asymmetric Crypto, TLS, PKI …dstefan/cse127-winter19/slides/lecture16.pdfKey Verification • Alice and Bob need a way to know that each has the real public

Encryption properties

• Encryption and decryption are inverse operations ➤ Dsk(Epk(m)) = m

• Secrecy: ciphertext reveals nothing about plaintext ➤ Computationally hard to decrypt without secret key

• What’s the point? ➤ Anybody with your public key can send you a secret

message!

Page 7: CSE 127: Computer Security Asymmetric Crypto, TLS, PKI …dstefan/cse127-winter19/slides/lecture16.pdfKey Verification • Alice and Bob need a way to know that each has the real public

Implementations

• ElGamal encryption (1985) ➤ Based on Diffie-Helman key exchange (1976), itself

invented by Diffie, Hellman, and Merkle

➤ Computational basis: hardness of discrete logarithms

• RSA encryption (1978) ➤ Invented by Rivest, Shamir, and Adleman

➤ Computational basis: hardness of factoring

Page 8: CSE 127: Computer Security Asymmetric Crypto, TLS, PKI …dstefan/cse127-winter19/slides/lecture16.pdfKey Verification • Alice and Bob need a way to know that each has the real public

Digital signatures

• Signing: (secret key, message) → signature ➤ Ssk(m) = s

• Verification: (public key, message, signature) → bool ➤ Vpk(m,s) = true | false

Sm v

skVv OK?

pk

m

Page 9: CSE 127: Computer Security Asymmetric Crypto, TLS, PKI …dstefan/cse127-winter19/slides/lecture16.pdfKey Verification • Alice and Bob need a way to know that each has the real public

Signature properties

• Verification of signed message succeeds ➤ Vpk(m,Ssk(m)) = true

• Unforgettability: can’t compute signature for a message m without secret key sk

• What’s the point? ➤ Anybody with your public key can verify that you

signed something!

Page 10: CSE 127: Computer Security Asymmetric Crypto, TLS, PKI …dstefan/cse127-winter19/slides/lecture16.pdfKey Verification • Alice and Bob need a way to know that each has the real public

• Digital Signature Algorithm (1991) ➤ Closely related to ElGamal signature scheme (1984)

➤ Computational basis: hardness of discrete logarithms

• RSA signatures ➤ Invented by Rivest, Shamir, and Adleman

➤ Computational basis: hardness of factoring

Implementations

Page 11: CSE 127: Computer Security Asymmetric Crypto, TLS, PKI …dstefan/cse127-winter19/slides/lecture16.pdfKey Verification • Alice and Bob need a way to know that each has the real public

Encrypted and signed messaging

Alice Bob

(this is a bad way to roll your own crypto)

Page 12: CSE 127: Computer Security Asymmetric Crypto, TLS, PKI …dstefan/cse127-winter19/slides/lecture16.pdfKey Verification • Alice and Bob need a way to know that each has the real public

Encrypted and signed messaging

Alice Bob

(this is a bad way to roll your own crypto)

(pkBob-E,skBob-E) (pkBob-S,skBob-S)

(pkAlice-E,skAlice-E) (pkAlice-S,skAlice-S)

Page 13: CSE 127: Computer Security Asymmetric Crypto, TLS, PKI …dstefan/cse127-winter19/slides/lecture16.pdfKey Verification • Alice and Bob need a way to know that each has the real public

Encrypted and signed messaging

Alice Bob

EpkAlice-E(m1)=c1 (c1, SskBob-S(c1))

(this is a bad way to roll your own crypto)

(pkBob-E,skBob-E) (pkBob-S,skBob-S)

(pkAlice-E,skAlice-E) (pkAlice-S,skAlice-S)

Page 14: CSE 127: Computer Security Asymmetric Crypto, TLS, PKI …dstefan/cse127-winter19/slides/lecture16.pdfKey Verification • Alice and Bob need a way to know that each has the real public

Encrypted and signed messaging

Alice Bob

EpkAlice-E(m1)=c1 (c1, SskBob-S(c1))

(this is a bad way to roll your own crypto)

(pkBob-E,skBob-E) (pkBob-S,skBob-S)

(pkAlice-E,skAlice-E) (pkAlice-S,skAlice-S)

if VpkBob-S(c1) DskAlice-E(c1)

Page 15: CSE 127: Computer Security Asymmetric Crypto, TLS, PKI …dstefan/cse127-winter19/slides/lecture16.pdfKey Verification • Alice and Bob need a way to know that each has the real public

Encrypted and signed messaging

Alice Bob

EpkAlice-E(m1)=c1 (c1, SskBob-S(c1))

(this is a bad way to roll your own crypto)

(pkBob-E,skBob-E) (pkBob-S,skBob-S)

(pkAlice-E,skAlice-E) (pkAlice-S,skAlice-S)

if VpkBob-S(c1) DskAlice-E(c1)

Page 16: CSE 127: Computer Security Asymmetric Crypto, TLS, PKI …dstefan/cse127-winter19/slides/lecture16.pdfKey Verification • Alice and Bob need a way to know that each has the real public

Practical Considerations

• Asymmetric cryptography operations are much more expensive than symmetric operations ➤ Even implementations based on elliptic curves!

➤ Don’t want to encrypt/sign huge messages

• Moreover: asymmetric primitives operate on fixed-size messages

Page 17: CSE 127: Computer Security Asymmetric Crypto, TLS, PKI …dstefan/cse127-winter19/slides/lecture16.pdfKey Verification • Alice and Bob need a way to know that each has the real public

What do we do in practice?

• Usually combined with symmetric for performance ➤ Use asymmetric to bootstrap ephemeral secret

Page 18: CSE 127: Computer Security Asymmetric Crypto, TLS, PKI …dstefan/cse127-winter19/slides/lecture16.pdfKey Verification • Alice and Bob need a way to know that each has the real public

Typical Encryption Usage

• Encryption: ➤ Generate a ephemeral (one time) symmetric secret

key

➤ Encrypt message using ephemeral secret key

➤ Encrypt ephemeral key using asymmetric encryption

• Decryption: ➤ Decrypt ephemeral key, decrypt message

Page 19: CSE 127: Computer Security Asymmetric Crypto, TLS, PKI …dstefan/cse127-winter19/slides/lecture16.pdfKey Verification • Alice and Bob need a way to know that each has the real public

Typical Signature Usage

• Signing: ➤ Compute cryptographic hash of message

➤ Sign it using asymmetric signature scheme

• Verification: ➤ Compute cryptographic hash of message

➤ Verify it using asymmetric signature scheme

Page 20: CSE 127: Computer Security Asymmetric Crypto, TLS, PKI …dstefan/cse127-winter19/slides/lecture16.pdfKey Verification • Alice and Bob need a way to know that each has the real public

Asymmetric Primitives

• Encryption and decryption

• Signing and verification

• Diffie Hellman key exchange

Page 21: CSE 127: Computer Security Asymmetric Crypto, TLS, PKI …dstefan/cse127-winter19/slides/lecture16.pdfKey Verification • Alice and Bob need a way to know that each has the real public

Diffie Hellman key exchange

• Establish a shared secret over public channel ➤ Invented by Diffie, Hellman, and Merkle

Alice Bob

Page 22: CSE 127: Computer Security Asymmetric Crypto, TLS, PKI …dstefan/cse127-winter19/slides/lecture16.pdfKey Verification • Alice and Bob need a way to know that each has the real public

Diffie Hellman key exchange

• Establish a shared secret over public channel ➤ Invented by Diffie, Hellman, and Merkle

Alice Bob

(pkBob,skBob)←DHKeygen()(pkAlice,skAlice)←DHKeygen()

Page 23: CSE 127: Computer Security Asymmetric Crypto, TLS, PKI …dstefan/cse127-winter19/slides/lecture16.pdfKey Verification • Alice and Bob need a way to know that each has the real public

Diffie Hellman key exchange

• Establish a shared secret over public channel ➤ Invented by Diffie, Hellman, and Merkle

Alice Bob

pkBob

(pkBob,skBob)←DHKeygen()(pkAlice,skAlice)←DHKeygen()

Page 24: CSE 127: Computer Security Asymmetric Crypto, TLS, PKI …dstefan/cse127-winter19/slides/lecture16.pdfKey Verification • Alice and Bob need a way to know that each has the real public

Diffie Hellman key exchange

• Establish a shared secret over public channel ➤ Invented by Diffie, Hellman, and Merkle

Alice Bob

pkBob

pkAlice

(pkBob,skBob)←DHKeygen()(pkAlice,skAlice)←DHKeygen()

Page 25: CSE 127: Computer Security Asymmetric Crypto, TLS, PKI …dstefan/cse127-winter19/slides/lecture16.pdfKey Verification • Alice and Bob need a way to know that each has the real public

Diffie Hellman key exchange

• Establish a shared secret over public channel ➤ Invented by Diffie, Hellman, and Merkle

Alice Bob

pkBob

pkAlice

(pkBob,skBob)←DHKeygen()(pkAlice,skAlice)←DHKeygen()

k←DHSecret(skBob,pkAlice)k←DHSecret(skAlice,pkBob)

Page 26: CSE 127: Computer Security Asymmetric Crypto, TLS, PKI …dstefan/cse127-winter19/slides/lecture16.pdfKey Verification • Alice and Bob need a way to know that each has the real public

Diffie Hellman key exchange

• Establish a shared secret over public channel ➤ Invented by Diffie, Hellman, and Merkle

Alice Bob

pkBob

pkAlice

Ek(m)

(pkBob,skBob)←DHKeygen()(pkAlice,skAlice)←DHKeygen()

k←DHSecret(skBob,pkAlice)k←DHSecret(skAlice,pkBob)

Page 27: CSE 127: Computer Security Asymmetric Crypto, TLS, PKI …dstefan/cse127-winter19/slides/lecture16.pdfKey Verification • Alice and Bob need a way to know that each has the real public

How do we get keys?

Page 28: CSE 127: Computer Security Asymmetric Crypto, TLS, PKI …dstefan/cse127-winter19/slides/lecture16.pdfKey Verification • Alice and Bob need a way to know that each has the real public

How do we get keys?

• Public keys are public: just ask for them! Alice Bob

Page 29: CSE 127: Computer Security Asymmetric Crypto, TLS, PKI …dstefan/cse127-winter19/slides/lecture16.pdfKey Verification • Alice and Bob need a way to know that each has the real public

How do we get keys?

• Public keys are public: just ask for them! Alice Bob

pkBob

Page 30: CSE 127: Computer Security Asymmetric Crypto, TLS, PKI …dstefan/cse127-winter19/slides/lecture16.pdfKey Verification • Alice and Bob need a way to know that each has the real public

How do we get keys?

• Public keys are public: just ask for them! Alice Bob

pkBob

pkAlice

Page 31: CSE 127: Computer Security Asymmetric Crypto, TLS, PKI …dstefan/cse127-winter19/slides/lecture16.pdfKey Verification • Alice and Bob need a way to know that each has the real public

How do we get keys?

• Public keys are public: just ask for them! Alice Bob

pkBob

pkAlice

EpkAlice(m)

Page 32: CSE 127: Computer Security Asymmetric Crypto, TLS, PKI …dstefan/cse127-winter19/slides/lecture16.pdfKey Verification • Alice and Bob need a way to know that each has the real public

How do we get keys?

• Public keys are public: just ask for them! Alice Bob

pkBob

pkAlice

EpkAlice(m)

Page 33: CSE 127: Computer Security Asymmetric Crypto, TLS, PKI …dstefan/cse127-winter19/slides/lecture16.pdfKey Verification • Alice and Bob need a way to know that each has the real public

How do we get keys?

• Public keys are public: just ask for them! ➤ No! Vulnerable to Man-in-the-Middle attacks! Alice Bob

Page 34: CSE 127: Computer Security Asymmetric Crypto, TLS, PKI …dstefan/cse127-winter19/slides/lecture16.pdfKey Verification • Alice and Bob need a way to know that each has the real public

How do we get keys?

• Public keys are public: just ask for them! ➤ No! Vulnerable to Man-in-the-Middle attacks! Alice Bob

pkBob

Page 35: CSE 127: Computer Security Asymmetric Crypto, TLS, PKI …dstefan/cse127-winter19/slides/lecture16.pdfKey Verification • Alice and Bob need a way to know that each has the real public

How do we get keys?

• Public keys are public: just ask for them! ➤ No! Vulnerable to Man-in-the-Middle attacks! Alice Bob

pkBob

Page 36: CSE 127: Computer Security Asymmetric Crypto, TLS, PKI …dstefan/cse127-winter19/slides/lecture16.pdfKey Verification • Alice and Bob need a way to know that each has the real public

How do we get keys?

• Public keys are public: just ask for them! ➤ No! Vulnerable to Man-in-the-Middle attacks! Alice Bob

pkEve pkBob

Page 37: CSE 127: Computer Security Asymmetric Crypto, TLS, PKI …dstefan/cse127-winter19/slides/lecture16.pdfKey Verification • Alice and Bob need a way to know that each has the real public

How do we get keys?

• Public keys are public: just ask for them! ➤ No! Vulnerable to Man-in-the-Middle attacks! Alice Bob

pkEve

pkAlice

pkBob

Page 38: CSE 127: Computer Security Asymmetric Crypto, TLS, PKI …dstefan/cse127-winter19/slides/lecture16.pdfKey Verification • Alice and Bob need a way to know that each has the real public

How do we get keys?

• Public keys are public: just ask for them! ➤ No! Vulnerable to Man-in-the-Middle attacks! Alice Bob

pkEve

pkAlice

pkBob

Page 39: CSE 127: Computer Security Asymmetric Crypto, TLS, PKI …dstefan/cse127-winter19/slides/lecture16.pdfKey Verification • Alice and Bob need a way to know that each has the real public

How do we get keys?

• Public keys are public: just ask for them! ➤ No! Vulnerable to Man-in-the-Middle attacks! Alice Bob

pkEve

pkAlice

pkBob

pkEve

Page 40: CSE 127: Computer Security Asymmetric Crypto, TLS, PKI …dstefan/cse127-winter19/slides/lecture16.pdfKey Verification • Alice and Bob need a way to know that each has the real public

How do we get keys?

• Public keys are public: just ask for them! ➤ No! Vulnerable to Man-in-the-Middle attacks! Alice Bob

pkEve

pkAlice

EpkEve(m)

pkBob

pkEve

Page 41: CSE 127: Computer Security Asymmetric Crypto, TLS, PKI …dstefan/cse127-winter19/slides/lecture16.pdfKey Verification • Alice and Bob need a way to know that each has the real public

How do we get keys?

• Public keys are public: just ask for them! ➤ No! Vulnerable to Man-in-the-Middle attacks! Alice Bob

pkEve

pkAlice

EpkEve(m)

pkBob

pkEve

Page 42: CSE 127: Computer Security Asymmetric Crypto, TLS, PKI …dstefan/cse127-winter19/slides/lecture16.pdfKey Verification • Alice and Bob need a way to know that each has the real public

How do we get keys?

• Public keys are public: just ask for them! ➤ No! Vulnerable to Man-in-the-Middle attacks! Alice Bob

pkEve

pkAlice

EpkAlice(m) EpkEve(m)

pkBob

pkEve

Page 43: CSE 127: Computer Security Asymmetric Crypto, TLS, PKI …dstefan/cse127-winter19/slides/lecture16.pdfKey Verification • Alice and Bob need a way to know that each has the real public

How do we get keys?

• Public keys are public: just ask for them! ➤ No! Vulnerable to Man-in-the-Middle attacks! Alice Bob

pkEve

pkAlice

EpkAlice(m)…

EpkEve(m)

pkBob

pkEve

Page 44: CSE 127: Computer Security Asymmetric Crypto, TLS, PKI …dstefan/cse127-winter19/slides/lecture16.pdfKey Verification • Alice and Bob need a way to know that each has the real public

How do we get keys?

• Public directory contains everyone’s public key

• To encrypt to a person, get their public key from directory

• No need for shared secrets!

Page 45: CSE 127: Computer Security Asymmetric Crypto, TLS, PKI …dstefan/cse127-winter19/slides/lecture16.pdfKey Verification • Alice and Bob need a way to know that each has the real public

How do we know Alice’s key is actually Alice’s?

Page 46: CSE 127: Computer Security Asymmetric Crypto, TLS, PKI …dstefan/cse127-winter19/slides/lecture16.pdfKey Verification • Alice and Bob need a way to know that each has the real public

Key Verification• Alice and Bob need a way to know that each has

the real public key of the other

• Ideal solution: Alice and Bob meet in person and exchange public keys

• Equivalent: Alice and Bob meet in person and exchange public key fingerprints ➤ Key fingerprint: cryptographic hash of public key

➤ Key itself can be sent in the open

Page 47: CSE 127: Computer Security Asymmetric Crypto, TLS, PKI …dstefan/cse127-winter19/slides/lecture16.pdfKey Verification • Alice and Bob need a way to know that each has the real public

Where have you seen this?

https://signal.org/blog/safety-number-updates/

Page 48: CSE 127: Computer Security Asymmetric Crypto, TLS, PKI …dstefan/cse127-winter19/slides/lecture16.pdfKey Verification • Alice and Bob need a way to know that each has the real public

Key Verification• Problem with ideal: Alice and Bob need to meet

➤ Impractical to meet and verify key of everyone …

• Practical solution: Use a trusted intermediary ➤ Alice and Bob have already exchanged keys w/ Claire

➤ Claire sends signed message with Alice’s key to Bob

➤ Claire sends signed message with Bob’s key to Alice

➤ Alice and Bob trust Claire to send the public keys

➤ Alice and Bob now have each other’s public key

Page 49: CSE 127: Computer Security Asymmetric Crypto, TLS, PKI …dstefan/cse127-winter19/slides/lecture16.pdfKey Verification • Alice and Bob need a way to know that each has the real public

Key Verification Improved• Claire creates a certificate:

“I, Charlie, verified that Alice’s key is … ”

• Claire signs the message and gives it to Alice ➤ Alice now has certificate attesting to her public key

• Alice sends Bob her public key and Claire’s cert

• Bob verifies signature on certificate

• Bob trusts Claire, accepts public key from Alice

Page 50: CSE 127: Computer Security Asymmetric Crypto, TLS, PKI …dstefan/cse127-winter19/slides/lecture16.pdfKey Verification • Alice and Bob need a way to know that each has the real public

Who is Claire?

• PGP world: Claire is any other person you trust

• Keybase world: Claire is a set of

• SSL world: Claire is a Certificate Authority

Page 51: CSE 127: Computer Security Asymmetric Crypto, TLS, PKI …dstefan/cse127-winter19/slides/lecture16.pdfKey Verification • Alice and Bob need a way to know that each has the real public

PGP (Web of Trust)

• PGP allows one user to attest to the accuracy of another user’s public key — key signing ➤ PGP does not use the term “certificate”

➤ Public key has set of signatures (equiv. certificates)

• A user can indicate how much they trust another user’s signature on a key

Page 52: CSE 127: Computer Security Asymmetric Crypto, TLS, PKI …dstefan/cse127-winter19/slides/lecture16.pdfKey Verification • Alice and Bob need a way to know that each has the real public

• Claire’s signature of Bob’s PGP key means Claire has verified that this is really Bob’s key ➤ Email address associated with key is Bob’s address

➤ Name associated with key is Bob

• Other people who trust Claire can use her signature on Bob’s key to be sure it is Bob’s key

PGP (Web of Trust)

Page 53: CSE 127: Computer Security Asymmetric Crypto, TLS, PKI …dstefan/cse127-winter19/slides/lecture16.pdfKey Verification • Alice and Bob need a way to know that each has the real public

Where is PGP used?

Page 54: CSE 127: Computer Security Asymmetric Crypto, TLS, PKI …dstefan/cse127-winter19/slides/lecture16.pdfKey Verification • Alice and Bob need a way to know that each has the real public

Where is PGP used?

Page 55: CSE 127: Computer Security Asymmetric Crypto, TLS, PKI …dstefan/cse127-winter19/slides/lecture16.pdfKey Verification • Alice and Bob need a way to know that each has the real public

Where is PGP used?

Page 56: CSE 127: Computer Security Asymmetric Crypto, TLS, PKI …dstefan/cse127-winter19/slides/lecture16.pdfKey Verification • Alice and Bob need a way to know that each has the real public

Where is PGP used?

Page 57: CSE 127: Computer Security Asymmetric Crypto, TLS, PKI …dstefan/cse127-winter19/slides/lecture16.pdfKey Verification • Alice and Bob need a way to know that each has the real public

Where is PGP used?

Page 58: CSE 127: Computer Security Asymmetric Crypto, TLS, PKI …dstefan/cse127-winter19/slides/lecture16.pdfKey Verification • Alice and Bob need a way to know that each has the real public

Where is PGP used?

Page 59: CSE 127: Computer Security Asymmetric Crypto, TLS, PKI …dstefan/cse127-winter19/slides/lecture16.pdfKey Verification • Alice and Bob need a way to know that each has the real public

Where is PGP used?

Page 60: CSE 127: Computer Security Asymmetric Crypto, TLS, PKI …dstefan/cse127-winter19/slides/lecture16.pdfKey Verification • Alice and Bob need a way to know that each has the real public

Where is PGP used?

Not really for email….

Page 61: CSE 127: Computer Security Asymmetric Crypto, TLS, PKI …dstefan/cse127-winter19/slides/lecture16.pdfKey Verification • Alice and Bob need a way to know that each has the real public

Who is Claire?

• PGP world: Claire is any other person you trust

• Keybase world: Claire is a set of

• SSL world: Claire is a Certificate Authority

Page 62: CSE 127: Computer Security Asymmetric Crypto, TLS, PKI …dstefan/cse127-winter19/slides/lecture16.pdfKey Verification • Alice and Bob need a way to know that each has the real public

Keybase world

• Challenge: verifying Alice’s key is actually Alice’s key on public directory

• Solution: Associate key with social network identifies ➤ Sign messages on GitHub, Twitter, Facebook, etc.

• Attacker model ➤ Attacher must compromise N of my account

Page 63: CSE 127: Computer Security Asymmetric Crypto, TLS, PKI …dstefan/cse127-winter19/slides/lecture16.pdfKey Verification • Alice and Bob need a way to know that each has the real public

Keybase world

• Challenge: verifying Alice’s key is actually Alice’s key on public directory

• Solution: Associate key with social network identifies ➤ Sign messages on GitHub, Twitter, Facebook, etc.

• Attacker model ➤ Attacher must compromise N of my account

Page 64: CSE 127: Computer Security Asymmetric Crypto, TLS, PKI …dstefan/cse127-winter19/slides/lecture16.pdfKey Verification • Alice and Bob need a way to know that each has the real public

Keybase world

• Challenge: verifying Alice’s key is actually Alice’s key on public directory

• Solution: Associate key with social network identifies ➤ Sign messages on GitHub, Twitter, Facebook, etc.

• Attacker model ➤ Attacher must compromise N of my account

Page 65: CSE 127: Computer Security Asymmetric Crypto, TLS, PKI …dstefan/cse127-winter19/slides/lecture16.pdfKey Verification • Alice and Bob need a way to know that each has the real public

Keybase world

• Challenge: verifying Alice’s key is actually Alice’s key on public directory

• Solution: Associate key with social network identifies ➤ Sign messages on GitHub, Twitter, Facebook, etc.

• Attacker model ➤ Attacher must compromise N of my account

Page 66: CSE 127: Computer Security Asymmetric Crypto, TLS, PKI …dstefan/cse127-winter19/slides/lecture16.pdfKey Verification • Alice and Bob need a way to know that each has the real public

Who is Claire?

• PGP world: Claire is any other person you trust

• Keybase world: Claire is a set of

• SSL world: Claire is a Certificate Authority

Page 67: CSE 127: Computer Security Asymmetric Crypto, TLS, PKI …dstefan/cse127-winter19/slides/lecture16.pdfKey Verification • Alice and Bob need a way to know that each has the real public

Announcements• Last PA due Tue/Sat

• Final: March 20th

• Review: Monday 4PM in 1202

• Today: Rehash certificates ➤ Then: A: General network security

B: DNS security C: Review

➤ Then: sphiel about ethics etc.

Page 68: CSE 127: Computer Security Asymmetric Crypto, TLS, PKI …dstefan/cse127-winter19/slides/lecture16.pdfKey Verification • Alice and Bob need a way to know that each has the real public

Certificate Authorities

• Certificate Authority: Trusted authority ➤ Signs keys after checking some kind of identity

(e.g., you own www.google.com)

➤ Server presents signed key (cert) to clients

➤ Browsers and OSes ship with public keys of trusted CAs

Page 69: CSE 127: Computer Security Asymmetric Crypto, TLS, PKI …dstefan/cse127-winter19/slides/lecture16.pdfKey Verification • Alice and Bob need a way to know that each has the real public

Certificate Authorities

CABrowser (Alice)

SKCA

Server (Bob)

PKCA

PKCA

Page 70: CSE 127: Computer Security Asymmetric Crypto, TLS, PKI …dstefan/cse127-winter19/slides/lecture16.pdfKey Verification • Alice and Bob need a way to know that each has the real public

Certificate Authorities

CA

PK and proof “I am Bob”

Browser (Alice)

SKCA

choose (SK,PK)

Server (Bob)

PKCA

PKCA

Page 71: CSE 127: Computer Security Asymmetric Crypto, TLS, PKI …dstefan/cse127-winter19/slides/lecture16.pdfKey Verification • Alice and Bob need a way to know that each has the real public

Certificate Authorities

CA

PK and proof “I am Bob”

Browser (Alice)

SKCAcheck proofissue Cert with SKCA :

Bob’s key is PK

choose (SK,PK)

Server (Bob)

PKCA

PKCA

Page 72: CSE 127: Computer Security Asymmetric Crypto, TLS, PKI …dstefan/cse127-winter19/slides/lecture16.pdfKey Verification • Alice and Bob need a way to know that each has the real public

Certificate Authorities

CA

PK and proof “I am Bob”

Browser (Alice)

SKCAcheck proofissue Cert with SKCA :

Bob’s key is PKBob’s

key is PK

choose (SK,PK)

Server (Bob)

PKCA

Verify cert

PKCA

Page 73: CSE 127: Computer Security Asymmetric Crypto, TLS, PKI …dstefan/cse127-winter19/slides/lecture16.pdfKey Verification • Alice and Bob need a way to know that each has the real public
Page 74: CSE 127: Computer Security Asymmetric Crypto, TLS, PKI …dstefan/cse127-winter19/slides/lecture16.pdfKey Verification • Alice and Bob need a way to know that each has the real public

Who are we trusting?

Page 75: CSE 127: Computer Security Asymmetric Crypto, TLS, PKI …dstefan/cse127-winter19/slides/lecture16.pdfKey Verification • Alice and Bob need a way to know that each has the real public

Who is this cert for?

Who are we trusting?

Page 76: CSE 127: Computer Security Asymmetric Crypto, TLS, PKI …dstefan/cse127-winter19/slides/lecture16.pdfKey Verification • Alice and Bob need a way to know that each has the real public
Page 77: CSE 127: Computer Security Asymmetric Crypto, TLS, PKI …dstefan/cse127-winter19/slides/lecture16.pdfKey Verification • Alice and Bob need a way to know that each has the real public

Who is this cert for?

Page 78: CSE 127: Computer Security Asymmetric Crypto, TLS, PKI …dstefan/cse127-winter19/slides/lecture16.pdfKey Verification • Alice and Bob need a way to know that each has the real public
Page 79: CSE 127: Computer Security Asymmetric Crypto, TLS, PKI …dstefan/cse127-winter19/slides/lecture16.pdfKey Verification • Alice and Bob need a way to know that each has the real public

CSE’s pub key info

Page 80: CSE 127: Computer Security Asymmetric Crypto, TLS, PKI …dstefan/cse127-winter19/slides/lecture16.pdfKey Verification • Alice and Bob need a way to know that each has the real public
Page 81: CSE 127: Computer Security Asymmetric Crypto, TLS, PKI …dstefan/cse127-winter19/slides/lecture16.pdfKey Verification • Alice and Bob need a way to know that each has the real public
Page 82: CSE 127: Computer Security Asymmetric Crypto, TLS, PKI …dstefan/cse127-winter19/slides/lecture16.pdfKey Verification • Alice and Bob need a way to know that each has the real public

Where we should check for revocation

information

Page 83: CSE 127: Computer Security Asymmetric Crypto, TLS, PKI …dstefan/cse127-winter19/slides/lecture16.pdfKey Verification • Alice and Bob need a way to know that each has the real public

Revocation• Problem: keys get compromised

➤ Attacker with a key can impersonate you and read messages encrypted to you

• Key expiration helps with this but not enough

• CA and PGP PKIs support revocation ➤ “I, Alice, revoke my public key … do not use it.”

➤ Signs revocation with her private key

➤ Others can verify Alice’s signature, stop using key

Page 84: CSE 127: Computer Security Asymmetric Crypto, TLS, PKI …dstefan/cse127-winter19/slides/lecture16.pdfKey Verification • Alice and Bob need a way to know that each has the real public

Revocation• In CA model, Alice asks CA to revoke certificate

➤ Alice does not need private key to do this

➤ CAs publish a Certificate Revocation List (CRL)

• In PGP model, only Alice can revoke her own key ➤ If Alice loses her private key, she can’t revoke

➤ Do not lose private key

➤ Option: generate revocation with key, store in secure place

Page 85: CSE 127: Computer Security Asymmetric Crypto, TLS, PKI …dstefan/cse127-winter19/slides/lecture16.pdfKey Verification • Alice and Bob need a way to know that each has the real public

Revocation

• CRL: Certificate Revocation List ➤ CA publishes list of revoked certs

➤ Client downloads the list

➤ Problem: Only care about few certs.

➤ Problem: What if CRL server is down?

Page 86: CSE 127: Computer Security Asymmetric Crypto, TLS, PKI …dstefan/cse127-winter19/slides/lecture16.pdfKey Verification • Alice and Bob need a way to know that each has the real public

Revocation

• OCSP: Online Certificate Status Protocol ➤ Query CA about cert when you get it from server

➤ Problem: Revealing visited sites to CA.

• OCSP stapling: Web server includes recent OCSP cert

Page 87: CSE 127: Computer Security Asymmetric Crypto, TLS, PKI …dstefan/cse127-winter19/slides/lecture16.pdfKey Verification • Alice and Bob need a way to know that each has the real public

Sometimes CAs go wrong• CAs get hacked or do the wrong thing:

➤ 2011: Comodo and DigiNotar CAs hacked, issue certs for Gmail, Yahoo! Mail, …

➤ 2013: TurkTrust issued cert for Gmail

➤ 2014: Indian NIC issue certs for Google and Yahoo!

➤ 2016: WoSignissues cert for GitHub

• Solution: Certificate transparency! ➤ CAs have to publish certs they issue

Page 88: CSE 127: Computer Security Asymmetric Crypto, TLS, PKI …dstefan/cse127-winter19/slides/lecture16.pdfKey Verification • Alice and Bob need a way to know that each has the real public
Page 89: CSE 127: Computer Security Asymmetric Crypto, TLS, PKI …dstefan/cse127-winter19/slides/lecture16.pdfKey Verification • Alice and Bob need a way to know that each has the real public

How is asymmetric key crypto used?

Page 90: CSE 127: Computer Security Asymmetric Crypto, TLS, PKI …dstefan/cse127-winter19/slides/lecture16.pdfKey Verification • Alice and Bob need a way to know that each has the real public

How are these used in TLS 1.3?

ClientHelloServerHello, [Certificate], [CertificateVerify], [Finished]

[Certificate], [CertificateVerify] Finished

AppilcationData

ApplicationData

Client Server

secret key

certS

Page 91: CSE 127: Computer Security Asymmetric Crypto, TLS, PKI …dstefan/cse127-winter19/slides/lecture16.pdfKey Verification • Alice and Bob need a way to know that each has the real public

How are these used in TLS 1.3?

Client Server

secret key

certS

Page 92: CSE 127: Computer Security Asymmetric Crypto, TLS, PKI …dstefan/cse127-winter19/slides/lecture16.pdfKey Verification • Alice and Bob need a way to know that each has the real public

How are these used in TLS 1.3?

ClientHello: nonceC , KeyShare

ServerHello: nonceS , KeyShare, Enc[certS,…]CertVerify: Enc[SigS(data)] , Finished

Client Server

secret key

certS

Page 93: CSE 127: Computer Security Asymmetric Crypto, TLS, PKI …dstefan/cse127-winter19/slides/lecture16.pdfKey Verification • Alice and Bob need a way to know that each has the real public

How are these used in TLS 1.3?

ClientHello: nonceC , KeyShare

ServerHello: nonceS , KeyShare, Enc[certS,…]CertVerify: Enc[SigS(data)] , Finished

Client Server

secret key

certS

Diffie-Hellman key exchange

Page 94: CSE 127: Computer Security Asymmetric Crypto, TLS, PKI …dstefan/cse127-winter19/slides/lecture16.pdfKey Verification • Alice and Bob need a way to know that each has the real public

How are these used in TLS 1.3?

ClientHello: nonceC , KeyShare

ServerHello: nonceS , KeyShare, Enc[certS,…]CertVerify: Enc[SigS(data)] , Finished

Client Server

secret key

Finished

session-keys ← HKDF( DHkey, nonceC , nonceS )

certS

Diffie-Hellman key exchange

Page 95: CSE 127: Computer Security Asymmetric Crypto, TLS, PKI …dstefan/cse127-winter19/slides/lecture16.pdfKey Verification • Alice and Bob need a way to know that each has the real public

How are these used in TLS 1.3?

ClientHello: nonceC , KeyShare

ServerHello: nonceS , KeyShare, Enc[certS,…]CertVerify: Enc[SigS(data)] , Finished

Client Server

secret key

Finished

session-keys ← HKDF( DHkey, nonceC , nonceS )

certS

Encrypted ApplicationData

Encrypted ApplicationData

Diffie-Hellman key exchange

Page 96: CSE 127: Computer Security Asymmetric Crypto, TLS, PKI …dstefan/cse127-winter19/slides/lecture16.pdfKey Verification • Alice and Bob need a way to know that each has the real public

How are these used in TLS 1.3?

ClientHello: nonceC , KeyShare

ServerHello: nonceS , KeyShare, Enc[certS,…]CertVerify: Enc[SigS(data)] , Finished

Client Server

secret key

Finished

session-keys ← HKDF( DHkey, nonceC , nonceS )

certS

Encrypted ApplicationData

Encrypted ApplicationData

Diffie-Hellman key exchange

TLS 1.2 handshake is way longer, requires encrypting w/ server public key, etc.

Page 97: CSE 127: Computer Security Asymmetric Crypto, TLS, PKI …dstefan/cse127-winter19/slides/lecture16.pdfKey Verification • Alice and Bob need a way to know that each has the real public

Brief overview of TLS 1.2

browser server

SKcert

Page 98: CSE 127: Computer Security Asymmetric Crypto, TLS, PKI …dstefan/cse127-winter19/slides/lecture16.pdfKey Verification • Alice and Bob need a way to know that each has the real public

Brief overview of TLS 1.2

browser server

SK

client-hellocert

Page 99: CSE 127: Computer Security Asymmetric Crypto, TLS, PKI …dstefan/cse127-winter19/slides/lecture16.pdfKey Verification • Alice and Bob need a way to know that each has the real public

Brief overview of TLS 1.2

browser server

SK

client-hello

server-hello + server-cert (PK)cert

Page 100: CSE 127: Computer Security Asymmetric Crypto, TLS, PKI …dstefan/cse127-winter19/slides/lecture16.pdfKey Verification • Alice and Bob need a way to know that each has the real public

Brief overview of TLS 1.2

browser server

SK

client-hello

server-hello + server-cert (PK)

key exchange (several options): EC-DHE

cert

Page 101: CSE 127: Computer Security Asymmetric Crypto, TLS, PKI …dstefan/cse127-winter19/slides/lecture16.pdfKey Verification • Alice and Bob need a way to know that each has the real public

Brief overview of TLS 1.2

browser server

SK

client-hello

server-hello + server-cert (PK)

key exchange (several options): EC-DHE

cert

client-key-exchange

server-key-exchange

kk

Page 102: CSE 127: Computer Security Asymmetric Crypto, TLS, PKI …dstefan/cse127-winter19/slides/lecture16.pdfKey Verification • Alice and Bob need a way to know that each has the real public

Brief overview of TLS 1.2

browser server

SK

client-hello

server-hello + server-cert (PK)

key exchange (several options): EC-DHE

Finished

cert

client-key-exchange

server-key-exchange

kk

Page 103: CSE 127: Computer Security Asymmetric Crypto, TLS, PKI …dstefan/cse127-winter19/slides/lecture16.pdfKey Verification • Alice and Bob need a way to know that each has the real public

Brief overview of TLS 1.2

browser server

SK

client-hello

server-hello + server-cert (PK)

key exchange (several options): EC-DHE

Finished

cert

client-key-exchange

HTTP data encrypted with KDF(k)

server-key-exchange

kk

Page 104: CSE 127: Computer Security Asymmetric Crypto, TLS, PKI …dstefan/cse127-winter19/slides/lecture16.pdfKey Verification • Alice and Bob need a way to know that each has the real public

What does TLS give you?• Nonces: prevent replay of an old session

• Forward secrecy: server compromise does not expose old sessions

• Some identity protection: certificates are sent encrypted ➤ SNI also encrypted so can’t see which server in clear

• (One sided) authentication: browser identifies server using server-cert

Page 105: CSE 127: Computer Security Asymmetric Crypto, TLS, PKI …dstefan/cse127-winter19/slides/lecture16.pdfKey Verification • Alice and Bob need a way to know that each has the real public

No excuse not use TLS!