Java Security: Illegal key size or default parameters?

前端 未结 19 1744
日久生厌
日久生厌 2020-11-22 03:34

I had asked a question about this earlier, but it didn\'t get answered right and led nowhere.

So I\'ve clarified few details on the problem and I would really like t

19条回答
  •  春和景丽
    2020-11-22 04:04

    In Java, by default AES supports a 128 Bit key, if you plans to use 192 Bit or 256 Bit key, java complier will throw Illegal key size Exception, which you are getting.

    The solution is as victor & James suggested, you will need to download JCE (Java Cryptography Extension) as per your JRE version,(java6, java7 or java8).

    The JCE zip contains following JAR:

    1. local_policy.jar
    2. US_export_policy.jar

    You need to replace these jar form your /jre/lib/security. if you are on a unix system the will probably refer to /home/urs/usr/lib/jvm/java--oracle/

    Sometimes just replacing local_policy.jar, US_export_policy.jar in security folder doesn't work on unix, so I suggest to copy security folder to your desktop first, replace the jar's @Desktop/security folder, delete the security folder from /jre/lib/ & move the Desktop security folder to /jre/lib/.

    eg :: sudo mv security /usr/lib/jvm/java-7-oracle/jre/lib

提交回复
热议问题