Symmetric Cryptography - Topic 3 Flashcards

1
Q

What is cryptography?

A

Cryptography is the “art of keeping messages secure” by Schneier

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
2
Q

What services can cryptography provide?

A

Confidentiality - (secrecy, privacy) of data in transmission & in storage

Integrity of Data (data authentication/authenticity) in transit & storage

Authentication of an identity (entity authentication)

Credential Systems (a proof of qualification or competence of a person)

Digital signatures

Electronic money (e.g. cryptocurrency Bitcoins)

Threshold cryptosystems
- A decryption key, or a signature signing key, is shared among a group of entities and a subset of those entities (more than some threshold number) have to collaborate to perform the decryption or signature signing

Secure multi-party computations (e.g. multiple parties compute a function jointly, the input is from the multiple parties, but no party should learn anything rather than its own input and the final result of the computation)

Digital rights management (e.g. activation of a software license by authorized users)

Electronic voting

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
3
Q

What type of cipher uses the same key

A

Symmetric ciphers: block and stream ciphers, e.g. DES, AES, one-time pad; same key is used.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
4
Q

What type of ciphers use different keys?

A

Asymmetric ciphers: RSA, DSA and DH; different keys are used.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
5
Q

What are SHA256 and AES-CBC examples of?

A

Hash and MACing functions

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
6
Q

List some cryptographic modes of encryption

A

CBC (cipher block chaining) mode, CTR (counter) mode

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
7
Q

Describe block ciphers

A

Plaintext is divided into blocks of fixed length and blocks are encrypted one at a time.

In addition to a key generation function, a block cipher has two functions, any encryption function E and a decryption function, D, such that:

C = E(K, M)
M = D(K,C)

Where C is ciphertext, M is plaintext and K is a secret (symmetric or a private key)

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
8
Q

What are the design criteria for block ciphers?

A

Completeness
Each bit of the output should depend on every bit of the input and every bit of the key

Avalanche effect (diffusion)
Changing one bit in the message input should change many bits in the output.
Also, changing one bit in the key should result in the change of many bits in the output

Statistical independence (confusion)
Input and output should appear to be statistically independent

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
9
Q

Can confusion and diffusion be achieved using substitution and permutation?

A

Yes

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
10
Q

What is the round function in a block cipher?

A

Typically uses permutations, substitutions, modular arithmetic

Takes an n-bit block and outputs an n-bit block

Each use of the round function employs a different subkey derived from K

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
11
Q

What comes from a larger block size in a block cipher? What are its typical values?

A

Greater security but makes encryption/decryption slower; typically n is 128-bit or 256-bit

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
12
Q

What is the effect of the key size in a block cipher? What are its typical values?

A

Larger keys size means greater security but reduced speed; a 128-bit size has become a norm

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
13
Q

What is the DES (data encryption standard)? When was it published? What kind of cipher is it?

A

Published in 1977, DES is a feistel (fancy block) cipher.
Block length is 64 bits, Key K is 56 bits; actually 8 bytes (64bits) but the 8th bit in each byte is a parity-check bit

The subkeys k1,k2,k3,…,k16 are each 48-bits, generated from key K

The DES decryption algorithm is the same as the encryption one; the only difference is that the keys for each round must be used in the reverse order, i.e. k16 first and k1 last

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
14
Q

What industry is DES the defacto industry standard for?

A

The bank industry

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
15
Q

Name some improvements over DES

A

Triple DES, AES

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
16
Q

What are the weaknesses of DES?

A

Design principles are secret, developed by US government so there might be a backdoor.

56 bit key is good enough to deter casual DES key browsing, but not for a dedicated adversary.

Takes an average of 2^55 trials to crack, supercomputer/botnet can do 10^12 a second

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
17
Q

What is triple DES?

A

Use of two or three DES keys.

EDE2 uses two DES keys (K1, K2) and the equation C = E(K1, D(K2, E(K1, M)))

EDE3 uses three DES keys (K1, K2) and the equation C = E(K3, D(K2, E(K1, M)))

The use of D has no security implication, it just makes Triple DES compatible with normal DES when K1 = K2 (this generalises to make EDE3 = EDE2 = normal DES, with certain keys being equal)

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
18
Q

What attack makes the effective key lengths for EDE2 and EDE3 much shorter?

A

The meet-in-the-middle attack

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
19
Q

What is the meet-in-the-middle attack?

A

With the Meet-in-the-Middle attack, the attacker first computes EK1(M) for all values of K1
and DK2(C) for all possible values of K2. He then compares the results from the two sets. If
the result from any of the EK1(M) set matches with a result from the DK2(C) set, the pair of
K1 and K2 is probably the correct keys.

20
Q

What were the conditions set by the US NIST call for algorithms to replace DES?

A

Stronger and faster than 3DES
Active life of 20-30 years (+ archival use)
Provide full specification & design details
Both C & Java efficient implementations

21
Q

What is the name of the AES standard

A

Advanced Encryption Standard (AES)

Rijndael

22
Q

What is the block size of AES

A

128 bits

23
Q

What are the possible key lengths of AES?

A

128, 192 or 256 bits, standard comprises three block ciphers AES-128, AES-192 and AES-256

24
Q

What type of cipher is DES

A

It is an iterative symmetric block cipher

Also a substitution - permutation cipher involving r rounds

25
Q

What are the r (rounds) value for the different key lengths in AES?

A

Key length - 128 bits, r = 10
Key length - 192 bits, r = 12
Key length - 256 bits, r = 14

26
Q

What does AES operate on to make it’s software implementation more efficient?

A

Operates on whole bytes for each round.

fixed block size of 128 bits (16 bytes) called a state

27
Q

What does each round transformation consist of in AES encryption?

A

Substitute bytes (SubBytes)
Shift rows (ShiftRows)
Mix columns (MixColumns)
Add round key (AddRoundKey)

28
Q

What is the SubBytes transformation?

A

Substitute Byes
A simple table/S-box lookup

One S-box for the whole cipher (defined / fixed in software), a 16x16 matrix of byte values, that contains a permutation of all possible 256 8-bit values

Each byte is replaced by a new byte indexed by row (left 4 bits) and column (right 4 bits) of the S-box

29
Q

What is the ShiftRows transformation?

A

A simple permutation (circular byte shift)
1st row: no change
2nd row: 1-byte circular left shift
3rd row: 2byte circular left shift
4th row: 3-byte circular left shift

Decryption uses circular right shift

This step permutes bytes between the columns

30
Q

Explain modular polynomial arithmetic

A

This is more of a TODO, go checkout the slides

31
Q

What is p, n and m for AES modular polynomial arithmetic?

A

p = 8, n = 2, m(x) = {100011011} or {11B}

32
Q

With Arithmetic in the finite field GF(2^8) with m(x) = (x^8+x^4+x^3+x+1) what is {03}*{6E}

A

{1011 0010}

33
Q

What is the AES mix columns function?

A

A function of all four bytes in the column; effectively a matrix multiplication in GF(2^8) using irreducible polynomial m(x) = x^8 + x^4 + x^3 + x + 1 (or {11B})

34
Q

Describe the Add Round Key stage of AES

A

Each byte of the state is combined with the round key using XOR, i.e. the 128 bits of state are bitwise XORed with the 128 bits of the round key.

The round key is derived from the cipher key using a key schedule

35
Q

If the input to AES has one difference what is the effect on the cipher text

A

A completely different cipher text is produced

36
Q

What are the main differences between DES and AES

A

Block size: 128 bit for AES, 64 bit for DES
Key Size: 56 bit for DES, 128, 192, 256 bit for AES
Design and evaluation process: DES closed, AES open

8 different S-boxes, 1 S-box

Design optimisation: DES for optimised hardware implementations, AES for byte-oriented implementations

DES and AES are substitution-permutation iterated ciphers, DES has a feistel structure AES does not

37
Q

How does one-time pad encrypt bit streams?

A

Using XOR
M xor K = C
C xor K = M

38
Q

Under what conditions does the one-time pad achieve perfect secrecy

A

If an only if there are as many possible keys as possible plaintexts, and every key is equally likely

39
Q

Benefits and problems with one-time pad stream ciphers

A

Benefit:
Bitwise xor is very computationally efficient

Problems:
Keys must be as long as the plaintext, this is impractical in most application scenarios.

Not secure if keys are reused.
Attacked can obtain XOR of plain-texts:
- M1 xor K = C1, M2 xor K = C2 and M1 xor M2 = C1 xor C2

If attacker gets hold of {M1, C1}, then K = M1 xor C1

40
Q

How can we encrypt large messages using a one-time pad stream cipher

A

Replace the random key in one-time pad with a pseudo-random sequence, generated by a cryptographic pseudo-random generator that is ‘seeded’ with the key.

There is still a possibility of the key being repeated

41
Q

What three modes can be used to encrypt messages longer than a block size?

A

ECB - Electronic code book mode
CBC - Cipher block chaining mode
CTR - Counter mode

42
Q

Describe ECB (Electronic Code Book) mode

A

Each block is encrypted independently using the same key. The last block is padded if necessary. Usually the last byte indicates the number of padding bytes added; this allows the received to remove the padding

Blocks are encrypted independently of other blocks
- Reordering ciphertext block results in correspondingly reordered plaintext blocks

The same block of plaintext, with the same key produces the same ciphertext so patters in plaintext show up in ciphertext

Error propagation: errors in one ciphertext block only affects the same plaintext block; they do no propagate to other blocks.

Not recommended for messages longer than one block of data.

43
Q

Describe CBC (Cipher Block Chaining) mode

A

Equation for encryption: Ci = E(K, M XOR Ci-1) where C0 = IV (Initialization vector)

See example in the slides

Ciphertext block Cj depends on plaintext Mj and all the preceding plaintext blocks.
- Reordering effects decryption
- Repeated patterns are concealed by the feedback
- There is error propogation

IV should be randomly selected but does not have to be secret.

Using different IVs in different encryption operations will make the same plaintext encrypted to different ciphertexts

44
Q

Describe CTR (Counter) Mode

A

Use a block cipher encryption function as the pseudorandom number generator to generate the key stream.

A counter value, equal to the block size, is used. For each encryption operation the value is different.

Typically the counter is initialised to some value, and then incremented by 1 for each subsequent block (modulo 2^n, where n is the block length)

CTR mode actually converts a block cipher to a stream cipher
Each block can be decrypted independently of the others
- Parallelizable
- Support random access
- The values to be XORed with the plaintext can be pre-computed.

The counter needs to be synchronised
- If a block is inserted into or deleted from the ciphertext stream then synchronization is lost and the plaintext cannot be recovered.

No error propagation
- A ciphertext block that is modified during transmission affects only the decryption of that block

In CTR mode the decryption function is not needed, since the stream cipher generates a new key with encrypt, that can then be used symmetrically

45
Q

Block ciphers vs Stream ciphers

A

Block ciphers encrypt blocks of characters, stream ciphers encrypt individual characters or bit streams.

Stream ciphers
- usually faster in hardware; mostly used for continuous communications and/or real-time applications.
- Require less memory space, so cheaper for resource restrained devices such as embedded sensors.
- Have limited or no error propagation, so advantageous when transmission errors are probably.
- Can be built out of block ciphers, e.g. by using CTR modes.

46
Q

What are some implementation flaws in ciphers

A

Use a secure random function from a crypto library.
- C’s rand should not be used for security applications.

IVs should be random
- Using NULL as IV is a vulnerability