title: error in encrypting image with RSA
body: <p>I need to encrypt an image of size 151*15 with RSA.</p>
  
  <p>This is the java code to encrypt the image file</p>
  
  <pre><code>import javax.crypto.Cipher;
  plaintext = time;
  cipher = Cipher.getInstance('RSA');
  keygen = java.security.KeyPairGenerator.getInstance('RSA');
  keyPair = keygen.genKeyPair();
  cipher.init(Cipher.ENCRYPT_MODE, keyPair.getPrivate())
  
  plaintextUnicodeVals = uint16(plaintext)
  plaintextBytes = typecast(plaintextUnicodeVals, 'int8')
  ciphertext = cipher.doFinal(plaintextBytes);
  </code></pre>
  
  <p>this is the image file to be encrypted</p>
  
  <p><img src="https://i.stack.imgur.com/tk82c.jpg" alt="enter image description here"></p>
  
  <p>I got the folllowing error</p>
  
  <p>Java exception occurred:</p>
  
  <pre><code>javax.crypto.IllegalBlockSizeException: Data must not be longer than 117 bytes
      at com.sun.crypto.provider.RSACipher.a(DashoA13*..)
      at com.sun.crypto.provider.RSACipher.engineDoFinal(DashoA13*..)
      at javax.crypto.Cipher.doFinal(DashoA13*..)
  </code></pre>
  
  <p>please give me the hint Or procedure so that i can approach in right direction.</p>
  
  <p>Thanks</p>