Although jdk1.4 includes the Java security package in the core library, if JCE is not configured, JCE cannot be used for development.
First, go to Sun.Download jce1.2.2(All I see on the Internet is downloading a package, and Sun's default package is useless ),Copy all the jar files in the decompressed lib to your_jdk \ JRE \ Lib \ Ext.(Your_jdk is your JDK installation directory ),Edit your_jdk \ JRE \ Lib \ SECURITY \ Java. Policy File, Add
Grant codebase " File: $ {java. Home}/lib/EXT/sunjce_provider.jar " {
Permission java. Io. filepermission
" File: $ {java. Home}/lib/EXT/sunjce_provider.jar " , " Read " ;
Permission java. Lang. runtimepermission
" Getprotectiondomain " ;
Permission java. Security. securitypermission
" Putproviderproperty. sunjce " ;
} ;
Grant access permissions to sunjce_provider
The optional provider type is configured in your_jdk \ JRE \ Lib \ SECURITY \ Java. Security. The default configuration is used here. (Here, the provider can also be replaced by the package provided by another vendor. I am not sure how to do it ).
Because I am using JBuilder for development, the link to the relevant database must be added. Therefore, add references to jce1_2_2.jar and sunjce_provider.jar in the properties library settings under the project. After the configuration is complete, you can perform JCE-relatedProgramCompiled.
I used JCE to write a small DES encryption and decryption program. I don't know why, but it runs very slowly. It seems that it takes time to load the provider. Even n doesn't know why Sun uses provider to install components, which is troublesome and unnecessary. I have not completed the configuration in eclipse for half a day, so I am depressed.