# Steganographic embedding of an RSA-encrypted message into an image

The goal is to combine the RSA encryption system with the LSB steganography system in a BMP image. Since every pixel of the image is an integer between 0 and 255, if we choose $p$ and $q$ such that $N = p \cdot q > 255$, how could a message encrypted with $RSA$ be embedded in the image?

• You split your RSA modulus over 2048 pixels. If a pixel (i.e. the byte) is odd, you know this one encodes to a "1" for the modulus, if the pixel is even it's a "0". – SEJPM Jan 10 '16 at 15:38
• Assume that my image is $256*256$ pixel. – Masoud Eskandari Jan 10 '16 at 15:56
• So you can encode 65536 bits in the lowest bits of each pixel, plenty for complete RSA keys (even for a complete private key I think - including CRT data) – SEJPM Jan 10 '16 at 15:58
• Since using LSB, We can not use the number grater $8$ bit. – Masoud Eskandari Jan 10 '16 at 19:15
• This question has nothing to do with RSA specifically. Your real problem seems to be that you haven't understood how LSB steganography works. – Ilmari Karonen Feb 9 '16 at 22:29

If I'm reading your question correctly, you want to hide an RSA encrypted message within a 256x256 BMP file and you're wondering how this can be done as each pixel only has a range of $[0;255]$.
This is fairly easy, as your message is likely to be shorter than the $256\times256=65536$ least significant bits at your disposal.
You first simply encrypt the message you want to send using standard RSA. This will usually result in a cipher text of length 2058 bits. You then go ahead and inspect the first (= least significant) bit of the cipher text. If it is $0$, you set the least significant bit of the first byte in the first row to zero. If it is $1$, you set the least significant bit of the first byte in the first row to $1$. You repeat this until you reach the end of your cipher text and go until the end of the row. If you reach the end of the row, you go ahead and continue in the next row. Once you reach the end of the cipher text you'll just treat the rest of the message as $0$.