Skip to content Skip to sidebar Skip to footer

Unable To Encrypt Special Characters: Not Multiple Of Block Length

I have an encryption/decryption algorithm and I'm trying to encrypt some special characters to send to the server from android, but it is throwing an exception: java.lang.Exceptio

Solution 1:

Change this line:

cipher = Cipher.getInstance("AES/CBC/NoPadding");

To

cipher = Cipher.getInstance("AES/CBC/PKCS5Padding");

Solution 2:

From this Blog

Change this line :

cipher = Cipher.getInstance("AES/CBC/NoPadding"); //this may be not decrypt full plaintext.

To:

cipher = Cipher.getInstance("AES/ECB/PKCS7Padding"); // use this for descrypt full plain text without lost.

Post a Comment for "Unable To Encrypt Special Characters: Not Multiple Of Block Length"