Title: Computer and Network Security
1Computer and Network Security
- Secret Key Cryptography
- (Chapter 3 and Chapter 4)
2Generic Block Encryption
- Random mapping from a block of plaintext to a
block of ciphertext - when any one bit of plaintext changes, every bit
in ciphertext has 50 chance to change - Substitution
- Space complexity O(k 2k)
- Permutation
- Space complexity O(k log k)
- Key
3Example
4Data Encryption Standard (DES)
- Designed by IBM, published by NIST in 1977
- 56-bit key, mapping a 64-bit input block to a
64-bit output block - Not secure any more
- Triple DES, 128-bit key
5DES Overview
6Initial/Final Permutations
- Do not increase security
- Page 66
7Generating Per-Round Keys
8A DES Round
9Mangler Function
10Other Secret Key Ciphers
- IDEA International Data Encryption Algorithm
- 64-bit block 128-bit key
- AES Advanced Encryption Standard
- 128-bit block 128-bit, 192-bit, 256-bit keys
11Overall Structure of AES
Nb 4 words block Nk 4, 6, 8 words key Nr
10, 12, 14 rounds encryption
12Primitive Operation 1 Block Substitution
13Primitive Operation 2 MixColumn
14MixColumn Shifted XOR
15Reverse of Block Substitution
16Reverse of MixColumn
17Key Expansion Set 0
18Key Expansion Set i
19Round Operations
- Block substitution
- Row 1 rotated left by 1 byte
- Row 2 rotated left by 2 bytes
- Row 3 rotated left by 3 bytes
- 3. MixColumn
20Decryption
- Reverse the operations
- Keys
- Block substitution
- MixColumn
- Rotation
21RC4
- One-time pad, generated by a stream cipher, which
is essentially a random number generator
22RC4
23Exercise
- Use rand() and srand() to write a stream cipher
that takes a key of arbitrary size and a message
of arbitrary size as input and produces a
cipher-text output.
24Encrypting Large Message
- Electronic Code Book (ECB)
- Cipher Block Chaining (CBC)
- k-Bit Cipher Feedback Mode (CFB)
- k-Bit Output Feedback Mode (OFB)
- Counter Mode (CTR)
25Electronic Code Book
- Identical ciphertext blocks for identical message
blocks - Predictable outcome by exchanging ciphertextblocks
26Cipher Block Chaining (CBC)
- Purpose of IV
- Predictable outcome by changing a bit in
ciphertext - Predictable outcome by rearranging ciphertext
27Output Feedback Mode (OFM)
- One-time pad can be generated in advance.
- A missing or inserted ciphertext block garbles
everything afterwards. - No block size.
- Predictable outcome by changing a bit in the
ciphertext.
28Cipher Feedback Mode
- Resynchronization after missing/extra ciphertext
blocks - Predictable outcome after a bit in ciphtertext is
changed, but more susceptible to detection - No block size
29Counter Mode (CTR)
- One-time pad can be generated in advance.
- Decryption at any point.
30Integrity Generating MAC
- Integrity protection, error detection, and error
correction - CRC and MAC
- The value of MAC is dependent on all message
blocks and their order. - How about use CFB to compute the residue.
31Privacy and Integrity
- Use one key to generate CBC residual, and append
the residual to the message - Use another key to do CBC encryption over the
whole thing - Why cant we use the same key?
- How to protect the integrity for other encryption
modes?
32Double DES or Triple DES
- M -gt E(k1) -gt E(k2) -gt C
- M -gt E(k1) -gt E(k2) -gt E(k3) -gt C
- M -gt E(k1) -gt D(k2) -gt E(k1) -gt C (encryption)
- C -gt D(k1) -gt E(k2) -gt D(k1) -gt m (decryption)
33Triple DES
- CBC outside v.s. inside
- Unpredictable outcome for one bit change
- No self-synchronization
- Parallel encryption
34More Block-Cipher Modes
- Block Chaining Mode
- A message block XORs with all previous ciphertext
blocks before encryption - No self-sychronization
- Predictable outcome after one bit change in
ciphertext
35More Block-Cipher Modes
- Propagating Cipher Block Chaining Mode
- A message block XORs with the previous message
block and the previous cipher block before
encryption. - Encryption and integrity in one pass
- Integrity check does not detect the swap of two
ciphertext blocks.
36More Block-Cipher Modes
- Cipher Block Chaining with Checksum
- A message block XORs with all previous message
blocks and the previous cipher block before
encryption. - No predictable outcome from a bit change in
ciphertext - Encryption and Integrity check in one pass
37Interleaving
- Divide one stream of message blocks to multiple
streams with interleaving blocks. This allows for
parallel encryption and decryption.
38More on Stream Cipher
- Linear Congruential Generators
- Xn (a Xn-1 b) mod m
- maximal period generator, a 84589, b 45989, m
217728 - Not Secure
39More on Stream Cipher
- Feedback Shift Register
- A shift register and a feedback function
40More on Stream Cipher
- Linear Feedback Shift Register
- The feedback function is simply the XOR of
certain bits in the register - Maximal period LFSR, (32, 7, 5, 3, 2, 1, 0)