Search code examples
rsapublic-keyencryption-asymmetricencryption

How to find plain text from RSA cipher text


I have a RSA cipher text c, the public key (e,n). (where c = m^e mod n)

Now I also have known the plain text m should be either "1234XXX" or "12345XXX", where "XXX" is a 3 digit number.

Can I find which one is right without testing all 3 digits number? (I just want to know if the first part is "1234" or "12345", and I don't care what the XXX is.)


Solution

  • You can't do that (it's a sort of know-plain-text attack). You can't derive any information on the key nor on the plain text, given an encrypted RSA message.

    (Similar plain text messages don't produce similar encrypted messages)

    So in your case, where you have the public key, you are still forced to encrypt all possible plain input messages (brute force), to discover the related encrypted messages.