0
$\begingroup$

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?

$\endgroup$
  • $\begingroup$ 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". $\endgroup$ – SEJPM Jan 10 '16 at 15:38
  • $\begingroup$ Assume that my image is $256*256$ pixel. $\endgroup$ – Masoud Eskandari Jan 10 '16 at 15:56
  • $\begingroup$ 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) $\endgroup$ – SEJPM Jan 10 '16 at 15:58
  • $\begingroup$ Since using LSB, We can not use the number grater $8$ bit. $\endgroup$ – Masoud Eskandari Jan 10 '16 at 19:15
  • $\begingroup$ This question has nothing to do with RSA specifically. Your real problem seems to be that you haven't understood how LSB steganography works. $\endgroup$ – Ilmari Karonen Feb 9 '16 at 22:29
3
$\begingroup$

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$.

$\endgroup$
  • 1
    $\begingroup$ If the message is a known, fixed length, then it is better to use random LSBs to fill up the image. That leaks less information to an attacker. If the message is variable length, then either encode the length as the first 16 bits of the message -- there is room -- or pad with 1000 ... 000 which can be cleanly removed. Zero padding isn't; the message may end with a 0 bit. $\endgroup$ – rossum Jan 10 '16 at 22:01
  • $\begingroup$ By implementing with MATLAB, I have problem, and I can not use big prime number. $\endgroup$ – Masoud Eskandari Jan 11 '16 at 11:24

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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