# In what cases will RSA not work? [duplicate]

I know that there are cases when RSA will not work like when the number to feed into the system is greater than the modulus. I was wondering if there were any other cases when RSA won't work

I looked all over and tried rephrasing the question in google many times

Edit: I am looking for what cases exist with a valid n, e and d used properly will not encrypt and decrypt correctly eg: message <= n

• try using 0 or 1 as plaintext... Commented Jul 5, 2015 at 22:06
• This contains some related information crypto.stackexchange.com/questions/1004/… Commented Jul 5, 2015 at 22:10
• @SEJPM 0 and 1 actually encrypt and decrypt just fine. Not securely, but yes correctly. Commented Jul 6, 2015 at 0:02

It should be proven in any presentation of RSA that, with a correct public modulus $N$, public exponent $e$ and private exponent $d$, all integers $m \in \{0,1,\dots,N-1\}$ satisfy $$\left(m^e\bmod N\right)^d\bmod N = m.$$ So it is only possible for a number to "not encrypt or decrypt correctly" when it is not in $\{0,1,\dots,N-1\}$. Moreover, this necessary condition is obviously also sufficient, because the result of a $\bmod N$ operation will be in this set, so if $m$ is outside it, it can't possibly equal the result of the above computation.