EncryptionOperationNotPossibleException by Jasypt with Bouncy Castle
Jasypt is designed to be used with JCE providers
, the terminology that this project uses on its web may be confusing you since there is the follow sentence:
Open API for use with any JCE provider, and not only the default Java VM one. Jasypt can be easily used with well-known providers like Bouncy Castle
From this sentence maybe you're understanding that Jasypt can be used with JCE
or with BouncyCastle like both are working differently or something like that; however, what this sentence means is that there are many JCE providers
, default providers which come with default java installation and non-default ones, however both accomplish the JCA/JCE
specification and both can work with Jasypt.
As I said BouncyCastle has a JCE provider
, from the bouncycastle you can see:
A provider for the Java Cryptography Extension and the Java Cryptography Architecture.
So if you're trying to make encrypt/decrypt operations using org.bouncycastle.jce.provider.BouncyCastleProvider
as provider you've got the same restrictions that all JCE
providers have, respect to available algorithms and key length.
To avoid this restrictions about key length and algorithms and to pass the errors you have, you must install Java Cryptography Extension (JCE) Unlimited Strength Jurisdiction Policy Files
for your jvm version.
For example for java 1.7 you can download the files from here. And then copy the jars in $JAVA_HOME\jre\lib\security overwriting the existing local_policy.jar
and US_export_policy.jar
.
Hope this helps.