AES加密时报java.security.InvalidKeyException Illegal key size

Contents

使用 AES 加密时,密钥大于128bit的话会抛出java.security.InvalidKeyException异常。因为密钥长度是受限的,根据网上一些博客中说的,这种限制是因为美国对软件出口的控制。解决办法很简单,下载对应版本的jce包,解压并覆盖 ${JAVA_HOME}/jre/lib/security/ 下的同名文件即可。

Java Cryptography Extension (JCE) Unlimited Strength Jurisdiction Policy Files 6

Java Cryptography Extension (JCE) Unlimited Strength Jurisdiction Policy Files 7 Download

Java Cryptography Extension (JCE) Unlimited Strength Jurisdiction Policy Files 8 Download

Updated:

Contents