Department of Electrical Engineering, IIT Bombay
October 13, 2025
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 as m \leftarrow \textsf{Dec}_{sk_A}(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}
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
A PPT adversary should not be able derive the decryption exponent d from the public key pk = \langle N,e \rangle
Since d = e^{-1} \bmod \phi(N), a PPT adversary should not be able to factor N
No polynomial-time algorithm is known for factoring in general but small factors can be found easily
The prime factors p and q should be large and random
Algorithm for generating an n-bit prime
Input: Length n, loop count t
Output: A uniform n-bit prime \begin{align*} & \textbf{for } i=1 \text{ to } t:\\ &\quad p' \leftarrow \{0,1\}^{n-1}\\ &\quad p \coloneqq 1 || p' \\ &\quad \textbf{if } p \text{ is prime } \textbf{return } p\\ &\textbf{return } \textsf{fail} \end{align*}
We need to clarify two points
Theorem: For any n > 1, the fraction of n-bit integers that are prime is at least \frac{1}{3n}
Set the loop count t = 3n^2
The probability that a prime is not chosen in all t iterations is at most \left(1-\frac{1}{3n}\right)^t \leq e^{-n}
First efficient algorithms were developed in the 70s
Probabilistic algorithms with following guarantees
A deterministic polynomial-time algorithm was found in 2002 by Agrawal, Kayal, Saxena (AKS)
Let \textsf{GenModulus} be a PPT algorithm that, on input 1^n, outputs (N,p,q) where N = pq, and p and q are n-bit primes except with probability negligible in n.
The factoring experiment \textsf{Factor}_{\mathcal{A}, \textsf{GenModulus}}(n):
We use p', q' in the above experiment because it is possible that \textsf{GenModulus} returns composite integers p, q albeit with negligible probability
Definition: Factoring is hard relative to \textsf{GenModulus} if for all PPT algorithms \mathcal{A} there exists a negligible function \textsf{negl} such that \Pr[\textsf{Factor}_{\mathcal{A}, \textsf{GenModulus}}(n) = 1] \le \textsf{negl}(n).
The factoring assumption states that there exists a \textsf{GenModulus} relative to which factoring is hard.
\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.
The RSA assumption is a stronger assumption than the factoring assumption