Need Help in Encrypting as well as Decrypting a file in java?
I want to encrypt and decrypt a file in java, i had read this url http://www-users.york.ac.uk/~mal503/lore/pkencryption.htm and got two files namely public Security certificate and private secur开发者_高级运维ity certificate file and private.pem file, i copied these files and pasted in the current directory , when i run this i got this error java.security.InvalidKeyException: Illegal key size or default parameters,i think may be openssl key generation is wrong, pls guide in proper path.
Until Java 9, the JDK shipped with only weak encryption, and simply will not allow the proper key sizes being created by openssl. The fix is happily very simple.
If you go to here to download "Java Cryptography Extension (JCE) Unlimited Strength Jurisdiction Policy Files 6". This will provide you with a ZIP file containing 4 files. One of these files is a README which has detailed instructions on what you do with the other files.
Once you have these policy files installed, you can use strong encryption and will not get this error message simply from using an AES-256 cipher.
精彩评论