# How can I match each encrypted message with the public key used to encrypt them for a common encryption attack RSA

I have five encryption mods ($n_1$ through $n_5$) with the same encryption exponent ($e$) and the same message encrypted using the five public keys giving $E_1$ through $E_5$ that were not given in a particular order. I am trying to use the Chinese remainder theorem attack (common encryption exponent attack). My question is as follows:

1) How can I match each encrypted message with the public key used to encrypt them? Do I just have to try all possible combinations until I get readable output? Since I have five pairs it would be a lot of permutations to try...

• a) There are only 120 permutations and you have a computer at your disposal being capable of doing thousands of encryptions per second... b) Are the messages padded in any way before being passed to the RSA primitive? – SEJPM Oct 10 '16 at 20:09
• They are ascii padded. I actually got it to work I think. The order didn't seem to matter at all... I tried it multiple ways and it didn't impact the content of the message... – Math4Life Oct 10 '16 at 21:15
• So would you mind answering your own question so future visitors will learn from your experiences? :) – SEJPM Oct 10 '16 at 21:18