AES Linux 解密出错

字体大小: 中小 标准 ->行高大小: 标准

出于兴趣,最近看了一下AES加密解密方面的一些东西,代码是JAVA写的,在Windows正常运行,到Linux上报javax.crypto.BadPaddingException: Given final block not properly

padded 。

解决方法:

KeyGenerator keyGen = KeyGenerator.getInstance("AES");

String pwd = "passordgggggg";

SecureRandom random=SecureRandom.getInstance("SHA1PRNG");

random.setSeed(pwd.getBytes());

keyGen.init(128, random);

此文章由 http://www.ositren.com 收集整理 ,地址为: http://www.ositren.com/htmls/64721.html