The $N$ and ciphertext are huge number that is more than 600 digits long.

I'm trying to find the prime factors of $N$ in order to get $p$ and $q$. Using $p$ and $q$ I can get $\phi(n)$. And using $\phi(n)$ and the public key I would be able to calculate the private key.

So, my question is if it is possible to recover the plaintext given that we have ciphertext and the public key?

If so, is it computationally feasible?

  • 8
    $\begingroup$ Doing so means essentially breaking the scheme, right? The public key is known (hence the term public), and the modulus $N$ is part of the public key. Thus, what you're asking is whether or not we can find the underlying plaintext corresponding to some given ciphertext, which should not be possible according to our belief on the security of RSA. $\endgroup$ – Daniel Jan 18 at 12:05
  • 3
    $\begingroup$ What kind of digits are that? Bits? Decimals? If they are decimals - which for us humans is kind of the default - then we're probably talking about a 2048 bit key, and RSA 2048 is certainly unbreakable if the key pair generation and decryption procedures are implemented correctly.... Please clarify the type of digits. $\endgroup$ – Maarten Bodewes Jan 18 at 13:06

It might be feasible, or not.

If "digits" had been binary digits or bits, the answer would have been yes. Anything about 600-bit can be factored by GNFS. The public record is for a 768-bit RSA modulus, factored in 2009. 600-bit is within reach of CADO-NFS and Msieve. That's even packaged into factoring as a service for semi-deep-pocketed script kiddies.

It could be that $N$ was poorly chosen and can be factored much more easily than by GNFS. Since the generation algorithm is unspecified, we can't tell. Poor RSA key generators have happened (see e.g. SmartFacts, ROCA, and predictable SSH hosts keys on way too many platforms).

It could also be that the encryption system used is plaintext RSA, where the ciphertext is $C=M^e\bmod N$ with $M$ the plaintext. This contrasts secure RSA, where $M$ is obtained from plaintext and randomness using a padding scheme such as OAEP. If $M$ is the plaintext (or a known deterministic function of the plaintext), some attacks much easier than factoring the modulus might be possible:

  • if $M$ is in a known small set (names on the class roll, 16-digit credit-card number), it is possible to enumerate possible $M$, perform encryption, and check against the ciphertext.
  • if $M=U\cdot V$ with $U<2^u$, $V<2^v$, $u\le v$ (which is likely when $M\ll2^{u+v}$ ) then there's a Meet-in-the-Midle attack with cost $O(2^v)$ time and $O(2^u)$ memory.
  • if $M<\sqrt[e]N$ we have the $e^\text{th}$ root attack (which can be extended to slightly larger $M$).
  • $\begingroup$ Could you post a link for the Meet-in -the-Middle attack? $\endgroup$ – kelalaka Jan 18 at 13:56
  • 1
    $\begingroup$ @kelalaka: see this, item 3 $\endgroup$ – fgrieu Jan 18 at 14:01

Your Answer

By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

Not the answer you're looking for? Browse other questions tagged or ask your own question.