Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Bear Bibeault
  • Devaka Cooray
  • Liutauras Vilda
  • Jeanne Boyarsky
Sheriffs:
  • Knute Snortum
  • Junilu Lacar
  • paul wheaton
Saloon Keepers:
  • Ganesh Patekar
  • Frits Walraven
  • Tim Moores
  • Ron McLeod
  • Carey Brown
Bartenders:
  • Stephan van Hulst
  • salvin francis
  • Tim Holloway

IllegalBlockSizeException  RSS feed

 
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??

 
Sheriff
Posts: 21465
97
Chrome Eclipse IDE Java Spring Ubuntu VI Editor 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?
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
    Bookmark Topic Watch Topic
  • New Topic
Boost this thread!