Bookmark Topic Watch Topic
  • New Topic

IllegalBlockSizeException

 
L Willie
Ranch Hand
Posts: 51
  • Mark post as helpful
  • send pies
  • Report post to moderator
Error message "Exception:javax.crypto.IllegalBlockSizeException: Data must not be longer than 128 bytes" display when read the cipherMessage from ciphertext.txt* [ciphertext.txt can keep correct cipher message since the content same as System.out.println("Message encrypted with keystore public key:\n" + new String(ciphertextBytes) + "\n");]
and try to decrypt it.

NO such error message and decrypt properly ONLY IF direct read message from "ciphertextBytes " that i encrypt message,that is replace textBytes = cipher.doFinal(cipherMessageBytes); with textBytes = cipher.doFinal(ciphertextBytes);
moreover,the message also can not too long,otherwise it ll prompt another error message "Exception:javax.crypto.IllegalBlockSizeException: Data must not be longer than 117 bytes"

hence i guess might be wrong during read the "ciphertext.txt" especially convert the String cipherMessage to Byte[] cipherMessageBytes .am i wrong on this convert process??

 
Rob Spoor
Sheriff
Pie
Posts: 20610
63
Chrome Eclipse IDE Java Windows
  • Mark post as helpful
  • send pies
  • Report post to moderator
That's the same question as this one. Let's continue in that thread, shall we?
 
    Bookmark Topic Watch Topic
  • New Topic