RSA BadPaddingException in Java - encrypt in Android decrypt in JRE

妖精的绣舞 提交于 2019-12-03 04:00:36

Unfortunaltey I currently don't have a running android system to test it but I guess that different padding algorithms may be choosen.

So give it a try and explicitley choose the padding algorithm, like this:

Cipher CheckCipher = Cipher.getInstance("RSA/ECB/PKCS1Padding");

Note that you also have to choose a block-chaining-mode in this case. In this case I've chosen "ECB" (=no block chaining), because I think this is the default.

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