Illegal key size问题

Illegal key size

在使用Cipher.init方法时突然报了一个异常java.security.InvalidKeyException: Illegal key size错误

java.security.InvalidKeyException: Illegal key size
        at javax.crypto.Cipher.checkCryptoPerm(Cipher.java:1039)
        at javax.crypto.Cipher.implInit(Cipher.java:805)
        at javax.crypto.Cipher.chooseProvider(Cipher.java:864)
        at javax.crypto.Cipher.init(Cipher.java:1396)
        at javax.crypto.Cipher.init(Cipher.java:1327)

下载后解压,将local_policy.jar和US_export_policy.jar以及readme.txt三个文件复制到JAVA_HOME/jre/lib/security目录下覆盖原来的文件

JDK7的下载地址: Java Cryptography Extension (JCE) Unlimited Strength Jurisdiction Policy Files 7 Download JDK8的下载地址: http://www.oracle.com/technetwork/java/javase/downloads/jce8-download-2133166.html

如何解决呢?需要去官方下载JCE无限制权限策略文件。

> https://zhhll.icu/2023/java基础/问题/Illegal key size/

你可能感兴趣的:(#,问题,java问题,1024程序员节)