出于兴趣,最近看了一下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);