Decrypting a string using RSA
the scenario is as follows: I am asked to implement a decryption algorithm
in Javascript to decrypt a string that was encoded using RSA with the
following algorithm:
Convert the string to some list of integers (4 chars to 1 integer) we call
this list u[].
Apply this operation for all elements in u[]: e[n] = RSA((u[n]-e[n-1]) mod
n), e[-1] = 0
Then we get the encrypted list of integers e[].
A textual description of step 2: We encrypt the first element, subtract
the encrypted first element from the second element. Then we do (modulo n)
and then encrypt the result. And the process continues for the rest of the
numbers.
Now the problem is the decryption part. I have been stuck at this part for
hours!
I worked with the equation, with the goal of making u[n] the subject:
e[n] = RSA((u[n]-e[n-1]) mod n) -- (1)
We know:
RSA(x) = x^e mod n -- (2)
RSA'(x) = x^d mod n -- (3)
So, from (1) and (3)
RSA'(e[n]) = (u[n]-e[n-1]) mod n
RSA'(e[n]) + k*n + e[n-1] = u[n]
Then i am kind of stuck, because we do not know k.
So, i tried again:
RSA'(e[n]) = (u[n]-e[n-1]) mod n
(e[n])^d mod n = (u[n]-e[n-1]) mod n
That seems to go no where too...
No comments:
Post a Comment