Docsity

Cryptography Overview: Principles, Techniques, and Applications, Lecture notes of Cryptography and System Security

Partial preview of the text

Download Cryptography Overview: Principles, Techniques, and Applications and more Lecture notes Cryptography and System Security in PDF only on Docsity!

Cryptography Overview

CS

Cryptography

Is

n A tremendous tool

n The basis for many security mechanisms

Is not

n The solution to all security problems

n Reliable unless implemented properly

n Reliable unless used properly

n Something you should try to invent

or implement yourself

Goal 1:secure communication

Step 1: Session setup to exchange key

Step 2: encrypt data

Goal 2: Protected files

Disk File 1 File 2 Alice Alice No eavesdropping No tampering Analogous to secure communication: Alice today sends a message to Alice tomorrow

Building block: sym. encryption

E, D: cipher k: secret key (e.g. 128 bits) m, c: plaintext, ciphertext n: nonce (aka IV) Encryption algorithm is publicly known

  • Never use a proprietary cipher Alice E m, n (^) E(k,m,n)=c Bob D c, n D(k,c,n)=m k k nonce

Use Cases

Single use key : (one time key)

  • Key is only used to encrypt one message
    • encrypted email: new key generated for every email
  • No need for nonce (set to 0)

Multi use key : (many time key)

  • Key used to encrypt multiple messages
    • files: same key used to encrypt many files

Stream ciphers (single use key)

Problem: OTP key is as long the message

Solution: Pseudo random key -- stream ciphers

Stream ciphers: RC4 (126 MB/sec) , Salsa20/12 (643 MB/sec) key PRG message

ciphertext

c ← PRG(k) ⊕ m

Dangers in using stream ciphers

One time key !! “Two time pad” is insecure:

C

1

← m

1

⊕ PRG(k)

C

2

← m

2

⊕ PRG(k)

Eavesdropper does:

C

1

⊕ C

2

→ m

1

⊕ m

2

Enough redundant information in English that:

m

1

⊕ m

2

→ m

1

, m

2

Building a block cipher

Input: (m, k)

Repeat simple “mixing” operation several times

  • DES: Repeat 16 times:
  • AES-128: Mixing step repeated 10 times

Difficult to design: must resist subtle attacks

  • differential attacks, linear attacks, brute-force, … mL ← mR mR ← mL⊕F(k,mR)

Block Ciphers Built by Iteration

R(k,m): round function

for DES (n=16), for AES-128 (n=10)

key k key expansion k 1 k 2 k 3 kn R(k 1

R(k 2

R(k 3

R(

k n

m c

In pictures

Correct use of block ciphers I: CBC mode E(k,⋅) E(k,⋅) E(k,⋅) IV m[0] m[1] m[2] m[3] ⊕ ⊕ ⊕ E(k,⋅) ⊕ IV c[0] c[1] c[2] c[3] ciphertext E a secure PRP. Cipher Block Chaining with random IV: Q: how to do decryption?

CBC with Unique IVs E(k,⋅) E(k,⋅) E(k,⋅) m[0] m[1] m[2] m[3] ⊕ ⊕ ⊕ E(k,⋅) ⊕ IV c[0] c[1] c[2] c[3] ciphertext IV E(k 1 ,⋅)

IV ′

unique IV means: (k,IV) pair is used for only one message. generate unpredictable IV’ as E(k 1 ,IV)

In pictures