Josh
2010-02-06 16:13:40 UTC
Here is what I understand:
1. Choose two distinct prime numbers, P and Q
2. Calculate the modulus as N = P * Q
3. Calculate the Euler Totient as phi(P,Q)=(P-1)(Q-1). PKCS#1 directs using the lambda(P,Q)=lcm(P-1,Q-1) where lcm denotes least common multiple, instead of the Euler Totient, but I have recently learned these values have the same multiplicative order (e.g. phi(P,Q) = k*lambda(P,Q) for some value k) so it doesn't really matter which one is used. For this description I will use lambda.
4. Choose a value for the encryption exponent, e, such that gcd( lambda(P,Q), e) = 1 (co-prime) and 1 < e < lambda(P,Q)
5. Calculate the decryption exponent d, such that e * d = 1 mod lambda(P,Q)
6. To encrypt a message m to ciphertext c, perform c = m^e mod N
7. To decrypt a message c to plain text m, perform m = c^d mod N
Up to this point I am fine with everything. I have tried many examples and it always works. Now I am trying to convince myself WHY this works.
Someone recently explained it like this:
m = c^d = (m^e)^d = m^(ed) mod N
That makes sense to me.
From part 5, above, we have that ed = 1 mod lambda(PQ), so we can re-write the above eq as:
m^(ed) = m^(1 + k*lambda[P,Q]) mod N
which simplifies to:
(m^1)*(m^lambda[P,Q])^k mod N
which means m^lambda[P,Q] mod N must evaluate to 1....and it does!
But WHY?
Why does m^lambda[P,Q] mod N always evaluate to 1? I'm not a math major so I usually get lost in the proofs or technical descriptions :(
Similarly, what guarantees that m^e mod N is a one-to-one function (e.g. that each value of m will map to a distinct value?) I suspect it has something to do with using prime numbers in the first place...but I haven't connected the dots.
Thanks to anyone that takes the time to enlighten me!
Josh