Basic Cryptography & HTTPS
CSE 598 Advanced Security of the Web
Fish Wang
Fall 2026
Cryptography
Applying Cryptography
Cleartext
Encryption
Ciphertext
A7&QK#L<
Decryption
Key
Key
What Will A Hacker Think?
Cryptanalysis
Given C1=E_K(P1), C2=E_K(P2), … derive P1, P2, … or K
Given P1, C1=E_K(P1), P2, C2=E_K(P2), … derive K or an algorithm to obtain Pi+1 from Ci+1 = E_K(Pi+1)
Given P1, C1=E_K(P1), P2, C2=E_K(P2), … where the attacker chooses P1, P2, …, derive K or an algorithm to obtain Pi+1 from Ci+1=E_K(Pi+1)
Security of a Cryptosystem
Plaintext
Key
Operation
Ciphertext
3 0 0 8 1 2 3 7 2 1 8 3
1 9 4 6 8 0 3 1 9 4 5 3
+
4 9 4 14 9 2 6 8 11 5 13 6
More on OTP
Security of a Cryptosystem
If trying all possible keys requires ten billion years with the most powerful computer, then the algorithm can be considered secure
In The Real World…
https://xkcd.com/538/
Crypto Algorithms
Crypto Algorithms
4541995603……………128393314541995603………….128393314541....
A sequence of numbers with an extremely long period.
Crypto Algorithms
Crypto Algorithms
Examples
MD4: d36183e60baff473fe3eaff527445f23
MD5: b62ba115efc8e9dc0509fc81d2b3facd
SHA1: 447c96527e26351b9452951abea9460b951cc81d
SHA-256: 23ae442892c1b454376f6d471534a59d49000da0c80ae5ff92b51f6238ab57f4
Secure Communication
Alice
Bob
Eve
Communication Using Symmetric Cryptography
Properties
Key Distribution Center (KDC)
Properties
Communication Using Asymmetric Cryptography
Properties
Communication Using Asymmetric Cryptography
A better version!
Properties
Diffie-Hellman Key Exchange
24
Diffie-Hellman Key Exchange (Cont’d)
25
Man-in-the-middle Attack
Public-key Certificates
X.509 Certificate
CA Signature
Communication Using Certificates
Communication Using Certificates
Communication Using Certificates
Request for Bob’s certificate
PKa
PKb
PKb
PKca
PKca
Request for Alice’s certificate
SKa
SKb
Alice
Bob
E_PKb(E_SKa(M))
PKa
Directory
Certifying Certification Authorities
Alice
Bob
Root CA
CA1
CA2
CA11
CA111
CA21
CA22
CA221
Conclusions
Imagine an attacker in a coffee shop
34
HTTPS
35
PKb
PKb
SKb
Alice
Bob.com
E_PKb(M)
CA
Request for Bob.com’s certificate
Request for a CA-signed certificate
PKca
PKca
An HTTPS URL
36
HTTP & HTTPS
37
What HTTPS aims to protect
Prevent attackers from reading the HTTP content.
Detect any changes to encrypted HTTP content.
Connect to the server for the requested host name.
38
Establishing the encrypted conduit
39
Establishing the encrypted conduit
40
TLS Handshake
TLS 1.3 handshake
41
TLS certificate
42
What can attackers learn about a TLS connection?
43
Multiple hosts on one IP
44
Ephemeral key exchange
45
Optimizations: Round Trip Time
46
HTTPS Failures
47
What can fail in HTTPS?
48
Attack scenarios
A middle box decrypting the traffic, examining or manipulating the traffic, and encrypting the traffic again before relaying
Decrypts the traffic offline�Detects and terminates the connection if anything “bad” is seen�The attacker defines what is bad
49
Fake or illegitimate certificates
50
How to defend?
51
Fake or illegitimate certificates
52
How to defend?
53
How to defend?
54
Broken certificate verification
55
SSL stripping
56
How to defend?
57
Protocol downgrade attacks
58
Software security issues
59
CRIME and BREACH: Compression side channels
60
Similar side channels
61
Mixed content
62
Mixed content in applications
63
CDN & HTTPS
The certificate is either issued by the CDN or provided by the owner of the website
Many attacks are conducted by hijacking HTTP connections between CDN and the original hosts
64