I have a question about how RSADP/RSAEP are defined (in RFC2437 https://datatracker.ietf.org/doc/html/rfc2437#section-5.1.2):
RSADP (and RSAEP) are described with the same limits for the message (m) and ciphertext (c), namely 0 <= m < n
. In this case the modular exponentiation primitive assumes padding has already occurred, so leaving that out of the picture.
5.1.2 RSADP
RSADP (K, c)
Input:
K RSA private key, where K has one of the following forms
-a pair (n, d)
-a quintuple (p, q, dP, dQ, qInv)
c ciphertext representative, an integer between 0 and n-1
Output:
m message representative, an integer between 0 and n-1; or
"ciphertext representative out of range"
I have the following question: do/should implementations actually accept 0 & 1 as valid c & m values? Wouldn't zero and one both remain constant under exponentiation, so that the cipher text and plain text would not change? Isn't that bad? Is it correct for an implementation to reject these values - even though the spec seems to allow them?
UPDATE: I'm not asking about padding per-se, since the exponentiation occurs after padding (in the encryption case), but rather why the spec seems to allow these insecure values at all. Why doesn't the spec disallow 0 & 1 explicitly? Admittedly it is statistically rare if the result of padding were such a value, but my question is shouldn't the RSADP/EP functions disallow these values and the overall OAEP scheme built on top of these functions be specified to choose a different padding input in that case?
Maybe there's something I'm missing here, so appreciate any info.
Thanks!