我想使用这些类 https://github.com/fukata/AES-256-CBC-Example 在我的项目中,但即使我编译它而不更改任何内容也会导致错误:
Exception in thread "main" java.lang.RuntimeException: java.security.InvalidKeyException: Illegal key size at AESUtil.encrypt(AESUtil.java:23) at AESMain.main(AESMain.java:10) Caused by: 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) at AESUtil.encrypt(AESUtil.java:20) ... 1 more
如何解决 key 大小非法? 我下载了它并将 java 文件夹复制到我的项目中。任何帮助将不胜感激:)
最佳答案
我相信您需要安装 Java Cryptography Unlimited Strength 扩展:
http://www.oracle.com/technetwork/java/javase/downloads/jce-7-download-432124.html
关于java - 使用来自 github 的 AES-256-CBC 加密,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/46818474/