Lecture 4 - Confidentiality
eecs-388
Overview
- confidentiality - keep the content of the message p secret from an eavesdropper
- let Eve be a passive eavesdropper, who sees everything on the channel but can’t change anything
Terminology
- p - plaintext
- c - ciphertext
- k - secret key
- - encryption function
- - decryption function
Historical Cryptography
Caesar Cipher (100-44 BC)
- replace each plaintext letter with a different one, using a fixed offset
- encryption:
- decryption:
- not very secure, you can easily brute force it or use frequency analysis (certain keys are used more than others)
Vigenere Cipher (c. 1553)
- encrypts successive letters using a sequence of Caesar ciphers keyed by the letters of a keyword
- for an n-letter “key word” ,
- encryption:
- decryption:
Modern Cryptography
One-time Pad (OTP)
- Alice and Bob share a secret, very long string of random bits
- encryption:
- decryption:
- pros:
- provably secure
- cons:
- can only use one time
- need to securely exchange the pad beforehand
Stream Cipher
- use a PRG instead of a truly random pad
- a PRG is practically indistinguishable from a random stream of bits, unless you know
- Alice and Bob choose , share secret key
- encryption:
- decryption:
- can’t reuse keys
- can’t reuse PRG output bits
- no way to prove that secure PRGs even exist
Block Cipher
- consists of a function that encrypts fixed-size (n-bit) blocks with a reusable key :
- and an inverse function that decrypts the blocks w hen used with same key:
- such that
- in effect, selects one permutation from the set of possible permutations of ‘s domain
- pseudorandom permutation (PRP) - a function that cannot practically be distinguished from a truly random permutation unless you know
- like PRFs, we don’t know if PRPs actually exist
AES Block Cipher
- Advanced Encryption Standard
- today’s most common block cipher
- standardized by NIST in 2001 after winning a long, public international design competition
- efficient in both SW and HW
- widely believed to be a secure PRP
- fixed block size: 128 bits
- variable key size: 128, 192, or 256 bits
- 10, 12, or 14 rounds (based on key size)
- generates subkeys from
- performs same set of operations times, each with a different subkey
Handling Arbitrary-Length Messages
Padding
- add n bits of padding of value n to get up to the block size (add entire block of padding if message ends exactly at the end of a block)
Cipher Modes
Flawed Approach
- encrypted codebook (ECB) mode
- simply encrypt each block independently
- every block containing the same plaintext is the same block of ciphertext
- simply encrypt each block independently
Cipher-Block Chaining (CBC) Mode
- “chains” ciphertexts to obscure later ones
- choose a random initialization vector (IV)
- encrypt:
- decrypt:
Counter (CTR) Mode
- turns a block cipher into a stream cipher
- generate keystreams for and unique nonce:
- encrypt:
- decrypt:
- can’t repeat nonce with same key
Getting Both Confidentiality and Integrity
- integrity: use a secure PRF as a verifier
- in practice, something like HMAC-SHA-256
- confidentiality: construct and from secure PRG (stream cipher) or secure PRP (block cipher) with appropriate padding/cipher mode
- in practice, something like AES-128 in CTR mode