DEV Community

Cover image for Encryption raised an exception
Keith
Keith

Posted on

Encryption raised an exception

script-test:
[echo] Testing encrypt.sh
[exec] Exception in thread “main” org.jasypt.exceptions.EncryptionOperationNotPossibleException: Encryption raised an exception. A possible cause is you are using strong encryption algorithms and you have not installed the Java Cryptography Extension (JCE) Unlimited Strength Jurisdiction Policy Files in this Java Virtual Machine
[exec] at org.jasypt.encryption.pbe.StandardPBEByteEncryptor.handleInvalidKeyException(StandardPBEByteEncryptor.java:1073)
[exec] at org.jasypt.encryption.pbe.StandardPBEByteEncryptor.encrypt(StandardPBEByteEncryptor.java:924)
[exec] at org.jasypt.encryption.pbe.StandardPBEStringEncryptor.encrypt(StandardPBEStringEncryptor.java:642)
[exec] at azkaban.crypto.CryptoV1_1.encrypt(CryptoV1_1.java:42)
[exec] at azkaban.crypto.Crypto.encrypt(Crypto.java:49)
[exec] at azkaban.crypto.EncryptionCLI.main(EncryptionCLI.java:58)

It was found that the error was because jdk did not have jce, so it was installed.

How to Install JCE

Go to the Oracle Java SE download page http://www.oracle.com/technetwork/java/javase/downloads/index.html
Scroll down … Under “Additional Resources” section you will find “Java Cryptography Extension (JCE) Unlimited Strength Jurisdiction Policy File”
Download the version that matches your installed JVM E.g. UnlimitedJCEPolicyJDK7.zip
Unzip the downloaded zip
Copy local_policy.jar and US_export_policy.jar to the $JAVA_HOME/jre/lib/security (Note: these jars will be already there so you have to overwrite them)
Then restart your application to get rid of this exception.

http://www.oracle.com/technetwork/java/javase/downloads/jce8-download-2133166.html

Top comments (0)