Department of Electrical Engineering, IIT Bombay
October 23, 2024
Suppose Bob wants to send a message to Alice
Alice will generate a public-private key-pair (pk_A, sk_A)
Alice will share pk_A with Bob over the public channel
Bob will encrypt a message m as c \leftarrow \textsf{Enc}_{pk_A}(m) and send c to Alice over the public channel
Alice will decrypt c using her private key sk_A
Public-key encryption is 2-3 orders of magnitude slower than private-key encryption
Hybrid encryption is often used in practice
Here \textsf{Enc} is a public-key encryption scheme and \textsf{Enc}' is a private-key encryption scheme
A public-key encryption scheme is a triple of PPT algorithms (\textsf{Gen}, \textsf{Enc}, \textsf{Dec}) such that:
(pk,sk) \leftarrow \textsf{Gen}(1^n)
For m \in \mathcal{M}_{pk}, c \leftarrow \textsf{Enc}_{pk}(m).
m \coloneqq \textsf{Dec}_{sk}(c), where m \in \mathcal{M}_{pk} \cup \{\perp\}.
It is required that \textsf{Dec}_{sk}\left( \textsf{Enc}_{pk}\left( m \right) \right) = m for any message m \in \mathcal{M}_{pk}, except with negligible probability over the randomness of \textsf{Enc} and \textsf{Dec}
In public-key encryption, the adversary always has access to an encryption oracle
Proposition: If a public-key encryption scheme has indistinguishable encryptions in the presence of an eavesdropper, it is CPA-secure
In 1985, Taher El Gamal constructed a public-key encryption scheme based on the Diffie-Hellman protocol
\textsf{Gen}:
\textsf{Enc}:
\textsf{Dec}:
Theorem: If the DDH problem is hard relative to \mathcal{G}, then the El Gamal encryption scheme is CPA-secure.
Proof
Consider the following PPT algorithm D that attempts to solve the DDH problem
Case 1: h_3 = g^z for uniform z \in \mathbb{Z}_q
Case 2: h_3 = g^{xy}
We could define an experiment as follows
But this does not allow \mathcal{A} to adaptively choose the messages
Theorem: If public-key encryption scheme \Pi is CPA-secure, then it also has indistinguishable multiple encryptions
Consequently, all the following security definitions are equivalent
Let t = t(n) be the number of oracle queries made by \mathcal{A}
For 0 \le i \le t, let \textsf{LR}_{pk}^i be the oracle that on input (m_0, m_1)
Note that \Pr\left[ \textsf{PubK}^{\textsf{LR-cpa}}_{\mathcal{A},\Pi}(n) =1\right] = \frac{1}{2} \Pr\left[\mathcal{A}^{\textsf{LR}_{pk}^t}(pk) = 0\right] \\+\frac{1}{2} \Pr\left[\mathcal{A}^{\textsf{LR}_{pk}^0}(pk) = 1\right]
It is enough to show that \bigg| \Pr\left[\mathcal{A}^{\textsf{LR}_{pk}^t}(pk) = 1\right] - \Pr\left[\mathcal{A}^{\textsf{LR}_{pk}^0}(pk) = 1\right]\bigg|\\ \le \textsf{negl}(n)
Consider an adversary \mathcal{A}' that eavesdrops on the encryption of a single message
It will use the adversary \mathcal{A} of the \textsf{PubK}^{\textsf{LR-cpa}}_{\mathcal{A},\Pi}(n) experiment as a subroutine
Note the IO interfaces of the two adversaries
Consider an adversary \mathcal{A}' that does the following
\mathcal{A}', given pk, chooses a uniform index i \leftarrow \{1,\ldots,t\}
\mathcal{A}' runs \mathcal{A}(pk), answering its jth oracle query (m_{j,0}, m_{j,1}) as follows:
\mathcal{A}' outputs the bit b' that is output by A
Consider the experiment \textsf{PubK}^{\textsf{eav}}_{\mathcal{A}',\Pi}
Fixing some i=i^*, note that if c_{i^*} is the encryption of m_{i^*,0} then \mathcal{A} is interacting with \textsf{LR}_{pk}^{i^*}
Then we have \begin{align*} & \Pr \left[ \mathcal{A}' \text{ outputs } 1 \mid b = 0\right] \\ & = \sum_{i^*=1}^t \Pr[i=i^*]\Pr \left[ \mathcal{A}' \text{ outputs } 1 \mid b = 0 \cap i = i^*\right] \\ & = \sum_{i^*=1}^t \frac{1}{t}\Pr \left[ \mathcal{A}^{\textsf{LR}_{pk}^{i^*}}(pk)=1\right] \\ \end{align*}
If c_{i^*} is the encryption of m_{i^*,1} then \mathcal{A} is interacting with \textsf{LR}_{pk}^{i^*-1}
Then we have \begin{align*} & \Pr \left[ \mathcal{A}' \text{ outputs } 1 \mid b = 1\right] \\ & = \sum_{i^*=1}^t \Pr[i=i^*]\Pr \left[ \mathcal{A}' \text{ outputs } 1 \mid b = 1 \cap i = i^*\right] \\ & = \sum_{i^*=1}^t \frac{1}{t}\Pr \left[ \mathcal{A}^{\textsf{LR}_{pk}^{i^*-1}}(pk)=1\right] \\ & = \sum_{i^*=0}^{t-1} \frac{1}{t}\Pr \left[ \mathcal{A}^{\textsf{LR}_{pk}^{i^*}}(pk)=1\right] \\ \end{align*}
Since \Pi is CPA-secure, we have \begin{align*}&\bigg| \Pr\left[ \mathcal{A}' \text{ outputs } 1 \mid b=0\right] \\ &\quad - \Pr\left[ \mathcal{A}' \text{ outputs } 1 \mid b=1\right]\bigg| \le \textsf{negl}(n)\end{align*}
This gives us \bigg| \Pr\left[\mathcal{A}^{\textsf{LR}_{pk}^t}(pk) = 1\right] - \Pr\left[\mathcal{A}^{\textsf{LR}_{pk}^0}(pk) = 1\right]\bigg|\\ \le t \cdot \textsf{negl}(n)
Let \textsf{GenRSA} be a PPT algorithm that on input 1^n, outputs a modulus N that is the product of two n-bit primes, along with integers e,d > 1 satisfying ed = 1 \bmod \phi(N)
\textsf{Gen:} On input 1^n, run \textsf{GenRSA}(1^n) to obtain N, e, and d
\textsf{RSA-inv}_{\mathcal{A}, \textsf{GenRSA}}(n):
Definition: The RSA problem is hard relative to \textsf{GenRSA} if for all PPT algorithms \mathcal{A} there exists a negligible function \textsf{negl} such that \Pr[\textsf{RSA-inv}_{\mathcal{A}, \textsf{GenRSA}}(n) = 1] \le \textsf{negl}(n).
The RSA assumption states that there exists a \textsf{GenRSA} relative to which RSA is hard.
Suppose an attacker knows that m < B
Given ciphertext c, the attacker can always determine m in \mathcal{O}(B) time
There is a better attack that recovers m in \mathcal{O}(\sqrt{B}) with high probability
Lemma: For appropriate \alpha \approx \frac{1}{2}, if m is a uniform n-bit integer then with high probability there exist r,s with 1 < r \le s \le 2^{\alpha n} for which m = r \cdot s
\hat{m} = s \| t where t = m' \oplus G(r) and s = r \oplus H(t)
RSA ciphertext is set to c = \hat{m}^e \bmod N
To decrypt c, first obtain \hat{m} as c^d \bmod N
To get m from \hat{m}, compute r = H(t) \oplus s \text{ and } m'= G(r) \oplus t