java jasypt suddenly crashes

Viewed 4789

Since yesterday my textencrypter(jasypt) stopped working for no reason. Here is a code example and the error msg. Does anybody know what is going on?

Code example:

        StrongTextEncryptor crypter = new StrongTextEncryptor();
        crypter.setPassword("Password");
        crypter.encrypt("Test");

Error msg:

Exception in thread "main" org.jasypt.exceptions.EncryptionInitializationException: java.lang.ExceptionInInitializerError
    at org.jasypt.encryption.pbe.StandardPBEByteEncryptor.initialize(StandardPBEByteEncryptor.java:773)
    at org.jasypt.encryption.pbe.StandardPBEStringEncryptor.initialize(StandardPBEStringEncryptor.java:566)
    at org.jasypt.encryption.pbe.StandardPBEStringEncryptor.encrypt(StandardPBEStringEncryptor.java:644)
    at org.jasypt.util.text.StrongTextEncryptor.encrypt(StrongTextEncryptor.java:107)
    at A.main(A.java:8)
Caused by: java.lang.ExceptionInInitializerError
    at com.ibm.icu.impl.NormalizerDataReader.<clinit>(NormalizerDataReader.java:300)
    at com.ibm.icu.impl.NormalizerImpl.<init>(NormalizerImpl.java:288)
    at com.ibm.icu.impl.NormalizerImpl.<clinit>(NormalizerImpl.java:35)
    at com.ibm.icu.text.Normalizer$Mode.normalize(Normalizer.java:188)
    at com.ibm.icu.text.Normalizer.normalize(Normalizer.java:1177)
    at com.ibm.icu.text.Normalizer.normalize(Normalizer.java:1146)
    at org.jasypt.normalization.Normalizer.normalizeWithIcu4j(Normalizer.java:205)
    at org.jasypt.normalization.Normalizer.normalizeToNfc(Normalizer.java:129)
    at org.jasypt.encryption.pbe.StandardPBEByteEncryptor.initialize(StandardPBEByteEncryptor.java:718)
    ... 4 more
Caused by: java.lang.IllegalArgumentException: Invalid version number: Version number may be negative or greater than 255
    at com.ibm.icu.util.VersionInfo.getInstance(VersionInfo.java:188)
    at com.ibm.icu.impl.ICUDebug.getInstanceLenient(ICUDebug.java:65)
    at com.ibm.icu.impl.ICUDebug.<clinit>(ICUDebug.java:69)
    ... 13 more
2 Answers

This is not a direct answer, but I'm putting it here in case someone runs upon the issue.

Using Java 1.8.0_275, I was getting a

java.lang.ExceptionInInitializerError

when running the encrypt.sh.

Jasypt version 1.9.3 is using an old version of icu4j-3.4.4.jar. I replaced the icu4j-3.4.4.jar with icu4j-68_2.jar then I was able to run:

./encrypt.sh input=password password=aSecret algorithm=PBEWithMD5AndDES

without error.

For more information, see https://github.com/jasypt/jasypt/issues/58. Even though this is a little different from how you're running jasypt, I'd recommend updating the icu4j.jar and try again.

Related