Need help with encryption as well as decrypting a file in java?

I want to encrypt and decrypt a file in java, I read this url http://www-users.york.ac.uk/~mal503/lore/pkencryption.htm and got two files, namely a public security certificate and a personal security file and the private.pem file, I copied these files and pasted them into the current directory, when I ran this, I got this error. java.security.InvalidKeyException: invalid key size or default parameters, I think it may be that openssl key generation is wrong, pls manual is on the right track.

0
source share
1 answer

Java comes with only weak encryption and simply will not allow you to create the correct key sizes using openssl. Fixing this is very simple.

If you go to here at the bottom of the page, you can download under the name "Java Cryptography Extension (JCE) of unlimited power. Jurisdiction policy files 6". This will provide you with a zip file containing 4 files. One of these files is README, which contains detailed instructions on what you do with other files.

After installing these policy files, you can use strong encryption and you won’t get this error message simply using AES-256 encryption.

+3
source

Source: https://habr.com/ru/post/1347686/


All Articles