Android-PHP-Encrypt-Decrypt
Android-PHP-Encrypt-Decrypt copied to clipboard
Can't encrypt unicode string - Java
Hi,
I have try to use your code to encrypt utf8 string but got an errr: javax.crypto.IllegalBlockSizeException: data not block size aligned.
Could you help to fix, please?
Hello, Does it happen every time you try or with an specific string?
Hi,
It happen anytime i try to encrypt the utf8 string. For ex, you can try to encrypt some english phonetic: ˌdef.ɪˈnɪʃ.ən, helˈəʊ
"javax.crypto.IllegalBlockSizeException: data not block size aligned. at com.android.org.bouncycastle.jce.provider.JCEBlockCipher.engineDoFinal(JCEBlockCipher.java:697)"
Many thanks.
Same here, I tried all sorts of ASCII type strings, and they all work. As soon as I type in one UTF-8 character, I get ----------java.lang.Exception: [encrypt] error:0607F08A:digital envelope routines:EVP_EncryptFinal_ex:data not multiple of block length ------------ (I must use UTF-8 as my customers speak Hebrew). I am completely flustered and would greatly appreciate it if you had some insight as to how to make it work with UTF-8.