Total Pageviews

2018/09/15

[Java] java.security.InvalidKeyException: Illegal key size or default parameters

Problem


When I try to use AES to do encryption and decryption, I got this error message:
Exception in thread "main" java.security.InvalidKeyException: Illegal key size or default parameters
 at javax.crypto.Cipher.checkCryptoPerm(Cipher.java:1026)
 at javax.crypto.Cipher.implInit(Cipher.java:801)
 at javax.crypto.Cipher.chooseProvider(Cipher.java:864)
 at javax.crypto.Cipher.init(Cipher.java:1249)
 at javax.crypto.Cipher.init(Cipher.java:1186)
 at test.albert.security.AESUtils.encrypt(AESUtils.java:25)
 at test.albert.security.AESUtils.main(AESUtils.java:41)


How-To

JCE download link: http://www.oracle.com/technetwork/java/javase/downloads/jce8-download-2133166.html



Screenshot for Step 2


Screenshot for Step 3


Reference
[1] https://stackoverflow.com/questions/6481627/java-security-illegal-key-size-or-default-parameters

No comments: