在DES加密是正确,解密时报错:javax.crypto.BadPaddingException: Given final block not properly padded
下面是解密代码:
public byte[] createDecryptor(byte[] buff){
try {
//根据密钥,对Cipher对象进行初始化,DECRYPT_MODE表示解密
c.init(Cipher.DECRYPT_MODE, deskey);

//得到明文,存入字符数组
cipherByte=c.doFinal(buff);
} catch (Exception e) {
e.printStackTrace();
}
return cipherByte;
}