RSA {1} RSA Keys: What are dQ, dP and InvQ?
Chinese remainder theory
In this case we generate an RSA key pair. With this we have two prime numbers ($p$ ans $q$), and compute the modulus ($N = pq$). We then pick ans encryption key value ($e = 0x010001$) and than compute $d = e^-1\pmod \phi$, and where $\phi = (p-1)(q-1)$. To encrypt a message($M$), we create a cipher $c = M^e\pmod N$, and than decrypt with $M = cd\pmod N$. The key pair also includes $dQ$, $dP$ and $invQ$, and these can be used with the Chinese remainder theory to optimize the decryption process.
New two prime numbers $p$ and $q$
compute the modules
$$N = p * q$$then pick an encryption exponent $e$ such that $1 < e < \varphi (N)$ and then compute:
$$ d = e^{-1} \pmod {\varphi (N)} $$and where:
$$ \varphi (N) = (p-1)(q-1) $$The public key is then $(e, N)$ and the private key is $(d, N)$. To encrypt a message $(M)$, we create a cipher:
$$ C = M^e \pmod N $$and then decrypt with:
$$ M = C^d \pmod N $$The key pair thus contains $e, N, d, p, q$ for a key pair of $(e, N)$ and $(d, N)$. It also has the values of $dQ$, $dP$ and $InvQ$. The values of $dQ$ is:
$$dQ = d \pmod {q-1}$$and $dP$ is:
$$dP = d \pmod {p-1}$$and $InvQ$ is:
$$InvQ = q^{-1} \pmod p$$We can use the values of $dQ$, $dP$ and $InvQ$ to speed up the decryption process. The decryption process is:
$$ c = M^d \pmod N $$To decrypt, we use less complex exponents:
$$ m_1 = c^dP \pmod p $$$$ m_2 = c^dQ \pmod q $$and then we use the Chinese Remainder Theorem to combine the two values:
$$ h = InvQ (m_1 - m_2) \pmod p $$The recovered message($m$) is then:
$$ m = m_2 + h \times q \pmod N $$ | |