0
$\begingroup$

Anyone know how can I perform this ? $$E(x_1)*E(x_2)=E(x_1*x_2)$$ I have already produced the keys and I can encrypt and decrypt using RSA. My goal is to multiply 2 encrypted integers in order to decrypt them and show how homomorphism works. I cant find the product of the two encrypted integers because i am not sure how to multiple( byte by byte or whole integers)? If any

$\endgroup$

1 Answer 1

3
$\begingroup$

With textbook RSA encryption defined as $E(x)=(x^e\bmod N)$ and decryption $D(y)=(y^d\bmod N)$, restricting to $0\le x_1<\sqrt N$ and $0\le x_2<\sqrt N$, we have$$E(x_1*x_2)=((E(x_1)*E(x_2))\bmod N)$$which let one compute $E(x_1*x_2)$ from $E(x_1)$ and $E(x_2)$; and $D(E(x_1*x_2))=x_1*x_2$, thus the enciphered product can be deciphered.

Note: in the above, all quantities are integers, $*$ is is integer multiplication, and $\bmod$ is modular reduction (similar to the % operator of C and Java), applied to large integers. $x^k\bmod N$ is equivalent to $1$ multiplied $k$ times by $x$ then reduced modulo $N$, but is to be computed with some efficient modular exponentiation method. The code implementing this multiplication, modular reduction, and modular exponentiation must be consistent with whatever representation of integers as bytes is used; no "byte by byte" multiplication has such consistency.

Problems are: textbook RSA encryption is not safe by modern cryptographic standards (in particular, any guess of $x$ can be checked by one knowing $x^e\bmod N$); and variants of textbook RSA safe against this are not homomorphisms (they are not even functions).

$\endgroup$
3
  • $\begingroup$ Thanks for your fast respond! I do not care about security. I want to perform an application thats multiplies two encrypted integers and i want to prove the mathematical equation. I cant find the product of the encrypted integers because i am not sure if i must multiply byte by byte or the whole number (binary). $\endgroup$
    – Teo Adam
    Jan 3, 2017 at 23:52
  • $\begingroup$ @Teo Adam: that you "do not care about security" is a strong indication that your question is off-topic. $\endgroup$
    – fgrieu
    Jan 4, 2017 at 7:42
  • $\begingroup$ If i cared about security i wouldnt use Rsa. This is a research for my school. I will create the code and then i will attack it. $\endgroup$
    – Teo Adam
    Jan 4, 2017 at 7:58

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