Exception in thread "main" javax.crypto.BadPaddingException: Given final block not properly padded

java des加密是直接用des会报错:Exception in thread "main" javax.crypto.BadPaddingException: Given final block not properly padded

 

找了半天,只能改用另一个方式,至于两种方式的区别,就自己去官方看api了www.twitterchina.net

//Exception in thread "main" javax.crypto.BadPaddingException: Given final block not properly padded
//  Cipher cipher=Cipher.getInstance("DES");
 Cipher cipher = Cipher.getInstance("DES/ECB/NoPadding");

来源:www.javait.org

posted @ 2017-02-17 17:31  magina_敌法  阅读(2259)  评论(0编辑  收藏  举报