kourosh parsa wrote:Hi guys.
[Here is my improved question regarding encryption]
I'm getting stuck with my encryption.
I'm getting this error:
javax.crypto.IllegalBlockSizeException: Input length not multiple of 16 bytes. I do NOT know why it's expecting 16 bytes and I do not know why we are expected to bring it to base 64...
so I tried filling the bytes up to be multiple of 16 but then after encoding and decoding, I get extra characters at the end.
here is my encryption:
Can someone explain to me why I need a multiple of 16 and how would I fix this please?
You really shouldn't modify previous posts like that -- after all, that is what the "reply" button is for.... by editing previous posts, nobody can really follow the topic, and your response rates drops dramatically.
kourosh parsa wrote:
javax.crypto.IllegalBlockSizeException: Input length not multiple of 16 bytes. I do NOT know why it's expecting 16 bytes and I do not know why we are expected to bring it to base 64...
so I tried filling the bytes up to be multiple of 16 but then after encoding and decoding, I get extra characters at the end.
Can someone explain to me why I need a multiple of 16 and how would I fix this please?
Simply. You requested "no padding", so you are responsible for making sure that the padding is correct. This means that you are responsible for ensuring the size is correct -- meaning filling it out to the correct size *and* removing the extra characters.
Henry