The default Java AES supports a maximum of 128bit keys, and throws an exception if you use a 256bit key:
|
Java.security.InvalidKeyException:Illegal Key Size |
In fact, the Java Official network provides a solution, need to download "Java Cryptography Extension (JCE) Unlimited strength jurisdiction Policy Files for Jdk/jre 8", replace the JDK 2 jar packages in the/JRE.
:
Http://www.oracle.com/technetwork/java/javase/downloads/jce8-download-2133166.html
The entrance to the JCE is pulled down on the Javase page to find the "Additional Resources", which can be seen:
650) this.width=650; "src=" Http://s5.51cto.com/wyfs02/M00/88/8D/wKiom1f7VkeBNLOVAAByxCmUdGs471.png "title=" 1.png " alt= "Wkiom1f7vkebnlovaabyxcmudgs471.png"/>
Download will get a ZIP package, the inside of the Local_policy.jar and Us_export_policy.jar extracted to the JDK installation directory \jre\lib\security overwrite the original file, The independent JRE is also covered with the same path files.
This article is from the "Rabbit Nest" blog, please be sure to keep this source http://boytnt.blog.51cto.com/966121/1860309
Java default does not support AES256