4
$\begingroup$

In the Paillier cryptosystem we choose $n=p\,q$ where $p$ and $q$ are primes, $g=n+1$, $\lambda=\phi(n)$, $\mu=\lambda^{-1}\bmod n$.

The public key is: $(n,g)$.

The private key is: $(\lambda,\mu)$.

Encryption: choose random $r$ ($0<r<n$), encryption of message $m$ is $c=(g^m)(r^n)\bmod n^2$

Decryption: $m=((c^\lambda\bmod n^2-1)/n)\,\mu\bmod n$.

I am asking: is it possible to decrypt the ciphertext of the Paillier cryptosystem with knowledge of the random number $r$?

$\endgroup$
6
  • $\begingroup$ Welcome to crypto-SE. I reformatted the question using MathJax. I have not changed to the usual decryption formula: $m=\bigl\lfloor((c^\lambda\bmod n^2)-1)/n\bigr\rfloor\,\mu\bmod n$, nor added the usual additional requirements $p\ne q$ and $p<2q<4p$. You can of course edit the question, perhaps adding where you are stuck. $\endgroup$
    – fgrieu
    Feb 3 at 10:46
  • 1
    $\begingroup$ Is that homework? That would make the question off-topic unless effort to solve the problem is shown in the question. For now I'll only give hints: with $r$ known, what remains unknown in the equation $c=(g^m)(r^n)\bmod n^2$ ? Work that out using the binomial theorem and elementary properties of$\bmod$. $\endgroup$
    – fgrieu
    Feb 3 at 11:17
  • $\begingroup$ I've reached this point: c = (nm+1) % (n2) + (rn) % (n**2). what should i do next? $\endgroup$ Feb 3 at 13:05
  • $\begingroup$ First, fix it; where did the second + creep in? Next, try to isolate the one unknown. Hint: almost all integers have a multiplicative inverse modulo $n^2$, and it can be efficiently computed, e.g. by the (half) extended Euclidean algorithm. Note: MathJax mostly works in comment too, e.g. $c=(g^m)(r^n)\bmod n^2$ is written $c=(g^m)(r^n)\bmod n^2$. $\endgroup$
    – fgrieu
    Feb 3 at 13:16
  • 1
    $\begingroup$ @poncho: I wrote my proof using the binomial theorem. I scratch my head for another argument that $(n+1)^m\equiv m\,n+1\bmod{n^2}$, or another proof altogether, but nothing happens. $\endgroup$
    – fgrieu
    Feb 19 at 20:44

2 Answers 2

2
$\begingroup$

Once you know $r$, you can remove it from the ciphertext. If $c=(1+n)^m\bmod n^2$ then $m=(c-1)/n\mod n.$

$\endgroup$
2
$\begingroup$

Yes, it would be possible to decrypt the ciphertext of the Paillier cryptosystem if the random number $r$ leaked.

Encryption if per $c=(g^m)(r^n)\bmod n^2$. We know that $g=n+1$. Thus $c=((n+1)^m)(r^n)\bmod n^2$. By the binomial theorem, $$(n+1)^m=\sum_{k=0}^m\binom n k n^k$$ and $n^k\bmod n^2=0$ when $k>1$. Therefore, $(n+1)^m\bmod n^2$ reduces to $m\,n+1\bmod n^2$, and we get $c=(m\,n+1)(r^n)\bmod n^2$.

Knowing $r$, and $n$ being public, we can computes $s=r^{-1}\bmod n$, e.g. by the (half) extended Euclidean algorithm. We can then compute $t=s^n\,c\bmod n^2$ which is such that $t=m\,n+1\bmod n^2$.

And then, since $0\le m<n$, we can compute $m$ as $(t-1)/n$.

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.