Review of Symmetric-Key Encryption

17
Review of Symmetric-Key Encryption Breno de Medeiros Department of Computer Science Florida State University Review of Symmetric-Key Encryption – p.1

Transcript of Review of Symmetric-Key Encryption

Page 1: Review of Symmetric-Key Encryption

Review of Symmetric-Key Encryption

Breno de Medeiros

Department of Computer Science

Florida State University

Review of Symmetric-Key Encryption – p.1

Page 2: Review of Symmetric-Key Encryption

Block Ciphers

A block cipher is a deterministic, stateless function from a key space K to apermutation of bit-strings (blocks) of a given, fixed length (the cipher’s block size).Being a permutation, it has an inverse.

1 0 . . . . . . . . . 1 10 0 . . . . . . . . . 0 0

1 1 . . . . . . . . . 1 10 1 . . . . . . . . . 1 1

0 0 . . . . . . . . . 0 01 1 . . . . . . . . . 1 1

1 0 . . . . . . . . . 1 11 1 . . . . . . . . . 0 1

Fo r e a c h k e y, t h e b l o c k c ip h e r in du c e s a p e r m u t a t i o n o n t h e b l o c k sp a c e

Breno de Medeiros, Florida State University :: Adv. Top. Crypt. Netw. Sec. – p.2

Page 3: Review of Symmetric-Key Encryption

Encrypting multiple blocks

It is possible to encrypt multiple blocks of data by simply repeatedlyinvoking the block cipher to encrypt each block independently.

This is called the Electronic Codebook (ECB) mode of encryption.

ECB reveals patterns about the data. The following images(example from Wikipedia article on modes of encryption), illustratethe effect of encrypting multiple data chunks with ECB:

Breno de Medeiros, Florida State University :: Adv. Top. Crypt. Netw. Sec. – p.3

Page 4: Review of Symmetric-Key Encryption

Stateful Encryption

To safely use a block cipher with the same key to encrypt multipleblocks, the stateless block cipher is used as a component of astateful encryption engine. (A finite state automata.)

There is an input buffer, an internal buffer S which initially storesthe initialization vector (IV), and an output buffer.

At each step, a block of data is read from the input buffer, the valueof the internal buffer is updated, and some value is written to theoutput buffer.

The block cipher implements (part of) the state transition functionand/ or the function that computes the output value from theinternal buffer state and input.

Breno de Medeiros, Florida State University :: Adv. Top. Crypt. Netw. Sec. – p.4

Page 5: Review of Symmetric-Key Encryption

CBC (detail)

Source: Wikipedia.

Breno de Medeiros, Florida State University :: Adv. Top. Crypt. Netw. Sec. – p.5

Page 6: Review of Symmetric-Key Encryption

Counter mode (CTR)

Source: Wikipedia.

Breno de Medeiros, Florida State University :: Adv. Top. Crypt. Netw. Sec. – p.6

Page 7: Review of Symmetric-Key Encryption

Security Notions for Symmetric Cryptography

Breno de Medeiros

Department of Computer Science

Florida State University

Breno de Medeiros, Florida State University :: Adv. Top. Crypt. Netw. Sec. – p.7

Page 8: Review of Symmetric-Key Encryption

Symmetric Encryption

Symmetric encryption is one of the core primitives of cryptography.A symmetric encryption scheme SE consists of three algorithms:

Key generation (probabilistic): using a source of randomness, outputsa key K—for simplicity, assume it to be an arbitrary bit-string offixed length τ , called the security parameter.

Encryption (probabilistic or deterministic, stateful or stateless): takesas input a key K, a state s (if stateful), a plaintext (arbitrary-lengthbit-string) M , and a source of randomness (if probabilistic), andoutputs the ciphertext C (a bit-string) and if stateful, a new state s′.

Decryption (deterministic and stateless): On input a key K and aciphertext C (presumably encrypted under K), outputs a plaintextM (a bit-string) or FAIL.

Breno de Medeiros, Florida State University :: Adv. Top. Crypt. Netw. Sec. – p.8

Page 9: Review of Symmetric-Key Encryption

Correctness and Security ofSymmetric Encryption

At a minimum, a symmetric encryption scheme must enablecommunication between two parties, i.e., the decryption algorithmmust be the reverse of the encryption. Therefore, in all cases, if C

is the encryption of message M under key K, then decrypting C

under the same key recovers M :

Correctness: Dec(K, Enc(K, M)) = M .

Intuitively, security could be defined as “without prior knowledge ofthe key, an attacker who obtains the ciphertext C does not learnanything new about the message M (except its approximatelength).” In what follows, we will define more rigorously this conceptas a concrete notion in computational complexity.

Breno de Medeiros, Florida State University :: Adv. Top. Crypt. Netw. Sec. – p.9

Page 10: Review of Symmetric-Key Encryption

Formal Security of Block Ciphers

In order to formalize the security of a block cipher, consider the following scenario.Two parties, A and B, wish to use a block cipher to communicate securely. Afterobserving a number of ciphertext blocks being sent from A to B, an eavesdroppershould not infer anything about the corresponding plaintext values, or about the keyused.

Let Fb the the set of all functions with domain and image equal to the space ofblocks of length b. The block cipher is an element of Fb, but typically chosen from amuch smaller subset fb.

Example: 128-bit AES has 128-bit block size and 128-bit keys. So, in this case,|fb| = 128 (2128 possible variations of AES), while |Fb| = 128 · 2128, as there are

2128·2128

functions with domain and image equal to the space of blocks of length128, and a similar number of permutations of such blocks.

Security of block ciphers is (formally) the inability of distinguishing between outputsof the block cipher (for a particular key) and outputs of a randomly chosen function(permutation) of blocks.

Breno de Medeiros, Florida State University :: Adv. Top. Crypt. Netw. Sec. – p.10

Page 11: Review of Symmetric-Key Encryption

Oracle machines

To define concretely the security of block ciphers and symmetricencryption, we need to capture the notion of an adversary.

An adversary has more resources than simply computing analgorithm. For instance, it may be able to obtain encryptions and/ordecryptions of data blocks.

This is modeled as an oracle.

An encryption oracle OK(·) accepts as input a data block, andreturns its encryption under key K.

A decryption oracle OK−1

(·) accepts as input a data block, andreturns its decryption under key K.

Breno de Medeiros, Florida State University :: Adv. Top. Crypt. Netw. Sec. – p.11

Page 12: Review of Symmetric-Key Encryption

Indistinguishibility under Adaptively-Chosen

Plaintext Attacks (IND-CPA)

An adaptive-chosen plaintext attack against indistinguisability is aprobabilistic algorithm (Turing machine) with access to anencryption oracle OK , that works in stages:

1st computational stage: The attacker can perform arbitrarycomputations and query OK for encryptions of blocks of hischoice.

proposal and challenge: The adversary submits two messages (ofthe same length in blocks) m0 and m1 to a challenger, whichselects one of two messages mb, b ∈ {0, 1} at random andreturns EncK(mb) (but not the value b) to the adversary.

2nd computational stage: Like the 1st stage.

Guess: The adversary outputs a guess bit b′ and wins theindistinguishibility game if b′ = b.

Breno de Medeiros, Florida State University :: Adv. Top. Crypt. Netw. Sec. – p.12

Page 13: Review of Symmetric-Key Encryption

IND-CPA

A dv e r s a ry

C h a l l e n g e rK⋅

p 1, p 2, p 3, . . ., p kc 1, c 2, c 3, . . ., c kPr o p o s a l: m 0, m 1Ch a l le n ge : C= E n c (K , m b )p k+ 1 , p k + 2, . . ., pnc k + 1, c k + 2, . . ., cn

Breno de Medeiros, Florida State University :: Adv. Top. Crypt. Netw. Sec. – p.13

Page 14: Review of Symmetric-Key Encryption

Can ECB mode be IND-CPA?

Discussion time.

Breno de Medeiros, Florida State University :: Adv. Top. Crypt. Netw. Sec. – p.14

Page 15: Review of Symmetric-Key Encryption

Indistinguishibility under Adaptively-Chosen

Ciphertext Attacks (IND-CCA)

An adaptive-chosen plaintext attack against indistinguisability is aprobabilistic algorithm with access to an encryption and decryptionoracle OK,K−1

, that works in stages:

1st computational stage: The attacker can perform arbitrarycomputations and query OK,K−1

on blocks of his choice(indicating for each, if encryption or decryption is desired).

proposal and challenge: The adversary submits (same length)messages m0 and m1 to a challenger, which selects one of twomessages mb, b ∈ {0, 1} at random and returns C = EncK(mb).

2nd computational stage: Like the 1st stage, but the adversary cannotquery for (decrypt, cj), where cj is some block of C.

Guess: The adversary outputs a guess bit b′ and wins if b′ = b.

Breno de Medeiros, Florida State University :: Adv. Top. Crypt. Netw. Sec. – p.15

Page 16: Review of Symmetric-Key Encryption

IND-CCA(2)

A dv e r s a ry

C h a l l e ng e rK, KS 1⋅

(p 1, de c r yp t ), (p 2, e n c r yp t ), . . ., (p k, ? )c 1, c 2, c 3, . . ., c kP r o p o s a l: m 0, m 1Ch a l l e n g e : C= E n c (K , m b )(p k+ 1, e n c r yp t ), (p k+ 2, de c r yp t ) . . ., p nc k+ 1, c k+ 2, . . ., c n

The adversary is not allowed, in the second stage, to query for the decryption of blocks

which are part of the challenge C = Enc(K, mb).

Breno de Medeiros, Florida State University :: Adv. Top. Crypt. Netw. Sec. – p.16

Page 17: Review of Symmetric-Key Encryption

Security Definition for Symmetricencryption

Let atk stand for either the string “cpa” or “cca.” Let Expind-atk-b(k) stand for aninstance of the IND-ATK game (either IND-CPA or IND-CCA), where b is the bit usedby the challenger, and k is the security parameter—i.e., the entropy of thekeyspace.

The advantage of the adversary (as a probabilistic algorithm), is by definition:

Advind−cpa(k) = Pr[Expind-cpa-1(k) = 1] − Pr[Expind-cpa-0(k) = 1].

We say that a symmetric encryption scheme SE is secure if, there does not exist aPTM A, and polynomials t(·), ℓ(·), p(·): exists such that:

takes less than t(k) steps to run.

makes queries totaling fewer than ℓ(k) bits.

has advantage higher than 1/p(k).

Breno de Medeiros, Florida State University :: Adv. Top. Crypt. Netw. Sec. – p.17