Command line Jasypt client encryption 'Operation not possible'
I faced this problem because of some lack of information in the Jasypt CLI usage description.
The default generator to generate the initial value is NoIvGenerator
. For some/most algorithms the IV generated this way is not valid, so the error message above is displayed. You have to add the additional parameter ivGeneratorClassName=org.jasypt.iv.RandomIvGenerator
to make it work.
See: https://github.com/jasypt/jasypt/issues/8
- The Java Cryptography Extension (JCE) Unlimited Strength Jurisdiction Policy (small download) can enable the higher strength algorithms.
https://www.oracle.com/technetwork/java/javase/downloads/jce-all-download-5170447.html
FYI: JDK 9 and later ship with, and use by default, the unlimited policy files.
The unlimited policy files for earlier releases available above are required only for JDK 8, 7, and 6 updates earlier than 8u161, 7u171, and 6u181. On those versions and later the policy files are included, but not enabled by default.
See JDK-8170157 for details. https://bugs.java.com/bugdatabase/view_bug.do?bug_id=JDK-8170157
- Another issue, could be that your
JAVA_HOME
environment variable points to an older Java version. Jasypt's bin/*.sh and *.cmd scripts uses$JAVA_HOME/bin/java
or%JAVA_HOME%\bin\java
if that environment variable exists.