RSA
Homomorphic
Property

Educational demo — does not provide actual protection — Bastiaan Quast — bastiaanquast.com

01 — Key parameters

Primes

n = P · Q

14

φ(n) = (P−1)(Q−1)

6

e — public exponent

5

gcd(e,φ)=1 ✓

d — private exponent

5

e·d mod φ = 1 ✓

02 — Plaintext inputs

plaintext product m₁·m₂ mod n

12

encrypt: c = me mod n²  /  decrypt: m = cd mod n

03 — Encryption & decryption

encrypt(m₁)

c₁

47

3⁵ mod 196

decrypt(c₁)

3

47⁵ mod 14

encrypt(m₂)

c₂

44

4⁵ mod 196

decrypt(c₂)

4

44⁵ mod 14

cipher product (no decryption)

c₁·c₂ mod n²

108

47·44 mod 196

decrypt

12

108⁵ mod 14

04 — Result

decrypt(c₁ · c₂ mod n²) ≡ m₁ · m₂ (mod n)
homomorphism holds decrypt(c₁·c₂ mod n²) = 12 = 3·4 mod 14

RSA is multiplicatively homomorphic: multiplying two ciphertexts and decrypting yields the same result as multiplying the plaintexts directly. The server never sees m₁ or m₂ — only their encryptions.

warning  inputs should be < n for well-defined results