# RSA2048 smallest possible modulus

what is the smallest possible modulus for RSA2048? I generate a random data with I want to encrypt by a textbook RSA2048 and I'm not sure where the first 1-bit should be.

According to OpenSSL source code and used padding function, the first byte seems to be 0, 2 follows and than there could be anything. Seems I need first 14bits to be 0 to ensure my plaintext fits the RSA modulus.

• what you mean by smallest module? See this: – kelalaka Dec 31 '18 at 13:51
• c^e mod m. The m is module/modulus? – smrt28 Dec 31 '18 at 13:53
• What is the reason other than curiosity? do you need to find $n=pq$ where two $p$ and $q$ are two primes such that $n$ is the smallest possible 2048-bit integer? – kelalaka Dec 31 '18 at 13:56
• No, the RSA2048 key is just a common OpenSSL generated key. I need to generate c that way I can be sure c < m and can be used as a plaintext RSA2048 input in general. – smrt28 Dec 31 '18 at 14:02
• For text book RSA every $m \in \mathbb{Z}_n$ is valid. For padded RSA see the link that I provided in the first comment. – kelalaka Dec 31 '18 at 14:04

The modulus defines the key length for RSA. So a 2048 bit key has a 1 at the leftmost bit. Otherwise there could be almost any number of zero's following it, each zero becoming less likely, as the modulus value depends on two large random primes - usually in the order of half the bit size of the modulus. So if you want to take a minimum modulus $$N$$ into account, you can have any 2047 bit message for plaintext RSA - as long as the most significant bit of the most significant byte is zero (commonly RSA uses big endian calculations, so that would be the highest order bit of the leftmost byte).