Why am I getting 'BadPaddingException' when decrypting?

青春壹個敷衍的年華 提交于 2019-11-30 07:45:57

From my initial comment:

A typical scenario is one where the key is different from the one used at the other side. This is the most probable cause, but you might also want to check the way you handle streams, because you really lack .close() and possibly .flush() statements. You also assume that you always can read all the data into the buffer, which may not be the case.

The key was indeed calculated incorrectly.

BadPaddingException Error in enryption/decryption

I encountered such an error, but this helped me

http://themasterofmagik.wordpress.com/2014/03/19/simple-aes-encryption-and-decryption-in-java-part1/

hope it helps you too.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!