歡迎來到Linux教程網
Linux教程網
Linux教程網
Linux教程網
Linux教程網 >> Linux基礎 >> Linux教程 >> AES Linux 解密出錯

AES Linux 解密出錯

日期:2017/2/28 14:55:40   编辑: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);

Copyright © Linux教程網 All Rights Reserved