🌑

Explore / Study / Computer Science / Cryptography 785 words | 4 minutes

§7 CPA Secure Encryption and Block Cipher Modes of Operation

  1. CPA Secure Encryption
    1. CPA-secure Encryption from Pseudorandom Functions
    2. Security of the CPA-secure encryption scheme
  2. Block Cipher Modes of Operation
    1. Cipher Block Chaining (CBC) mode
    2. Electronic Code Book (ECB) mode
    3. Counter (CTR) mode

CPA Secure Encryption

CPA-secure Encryption from Pseudorandom Functions

  • Construction of CPA-secure encryption scheme Π\Pi from any pseudorandom function. Let FF be a pseudorandom function. Define a private-key encryption scheme Π\Pi for messages of length nn as:
    • GenGen : given input 1n1^n, output uniform key k{0,1}nk \leftarrow \{0,1\}^n.
    • EncEnc : given inputs a key k{0,1}nk \in \{0,1\}^n and a message m{0,1}nm \in \{0,1\}^n, choose a uniform r{0,1}nr \in \{0,1\}^n and output the ciphertext c:=r,Fk(r)mc := \left \langle r, F_k(r) \oplus m \right \rangle.
    • DecDec : given inputs a key k{0,1}nk \in \{0,1\}^n and a ciphertext c=r,sc = \langle r, s \rangle, output the plaintext message m:=Fk(r)sm := F_k(r) \oplus s.

Security of the CPA-secure encryption scheme

  • Theorem. If FF is a pseudorandom function, then the construction Π\Pi is a CPA-secure private-key encryption scheme for messages of length nn.

Block Cipher Modes of Operation

Cipher Block Chaining (CBC) mode

  • GenGen: On input 1n1^n, output a uniformly chosen key of length nn, i.e., k{0,1}nk \leftarrow \{0,1\}^n.
  • EncEnc: To encrypt message m=m1m2mlm = m_1m_2 \ldots m_l where each block mi{0,1}nm_i \in \{0,1\}^n, we do the following:
    • Choose random initialization vector (IVIV) of length nn, i.e., set c0=IV{0,1}nc_0 = IV \leftarrow \{0,1\}^n.
    • For i=1i = 1 to ll, set ci=Fk(ci1mi)c_i = F_k (c_{i-1} \oplus m_i).
    • Output c0,c1,,cl\langle c_0, c_1, \ldots, c_l\rangle.
  • DecDec: Given inputs c0,c1,,cl\langle c_0, c_1, \ldots, c_l\rangle and k{0,1}nk \in \{0,1\}^n, compute mi:=Fk1(ci)ci1m_i := F^{-1}_k (c_i) \oplus c_{i-1} for i=1i = 1 to ll. Output m1,,ml\langle m_1, \dots, m_l \rangle.
  • Theorem. If FF is a pseudorandom function, then the construction Π\Pi is a CPA-secure private-key encryption scheme for messages of length lnl \cdot n.

Electronic Code Book (ECB) mode

  • GenGen: On input 1n1^n, output a uniformly chosen key of length nn, i.e., k{0,1}nk \leftarrow \{0,1\}^n.
  • EncEnc: To encrypt message m=m1m2mlm = m_1m_2 \ldots m_l where each block mi{0,1}nm_i \in \{0,1\}^n, we do the following:
    • For i=1i = 1 to ll, set ci=Fk(mi)c_i = F_k (m_i).
    • Output c1,,cl\langle c_1, \ldots, c_l\rangle.
  • DecDec: Given inputs c1,,cl\langle c_1, \ldots, c_l\rangle and k{0,1}nk \in \{0,1\}^n, compute mi:=Fk1(ci)m_i := F^{-1}_k (c_i) for i=1i = 1 to ll. Output m1,,ml\langle m_1, \dots, m_l \rangle.

Counter (CTR) mode

  • GenGen: On input 1n1^n, output a uniformly chosen key of length nn, i.e., k{0,1}nk \leftarrow \{0,1\}^n.
  • EncEnc: To encrypt message m=m1m2mlm = m_1m_2 \ldots m_l where each block mi{0,1}nm_i \in \{0,1\}^n, we do the following:
    • Choose a uniform value ctr{0,1}n\texttt{ctr} \in \{0,1\}^n. Generate the pseudorandom stream yi:=Fk(ctr+i)y_i := F_k (\text{ctr} + i) where ctr\texttt{ctr} and ii are viewed as integers and addition is done modulo 2n2^n.
    • For i=1i = 1 to ll, set ci:=yimic_i := y_i \oplus m_i.
    • Output ctr,c1,,cl\langle \texttt{ctr}, c_1, \ldots, c_l\rangle.
  • DecDec: Given inputs c0,c1,,cl\langle c_0, c_1, \ldots, c_l\rangle and k{0,1}nk \in \{0,1\}^n, compute mi:=Fk(c0+i)cim_i := F_k (c_0 + i) \oplus c_i for i=1i = 1 to ll. Output m1,,ml\langle m_1, \dots, m_l \rangle.
  • Theorem. If FF is a pseudorandom function, then CTR mode is CPA-secure.

— Feb 14, 2023

Creative Commons License
§7 CPA Secure Encryption and Block Cipher Modes of Operation by Lu Meng is licensed under a Creative Commons Attribution-NonCommercial-ShareAlike 4.0 International License. Permissions beyond the scope of this license may be available at About.