Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

jasypt: ecryption of Properties failed, make sure encryption/decryption passwords match apres upgrading from version 2.3 to 3.0.5 #393

Closed
boufenzi opened this issue Apr 20, 2024 · 1 comment

Comments

@boufenzi
Copy link

boufenzi commented Apr 20, 2024

hello guys i have a problem with jasypt-spring-boot, after upgrading this maven dependency my decryption does not work anymore, i'm getting Caused by: com.ulisesbocchio.jasyptspringboot.exception.DecryptionException: Unable to decrypt property: ENC(/mlNAXHOWyj+ePy7k0JC6WiYxxssJz+57fz97o........) resolved to: ENC(/mlNAXHOWyj+ePy7k0JC6WiYxxssJz+57fz97o....). Decryption of Properties failed, make sure encryption/decryption passwords match
i'm using database.encryption.algorithm=PBEWITHHMACSHA512ANDAES_128
and here is my config:

   private static PooledPBEStringEncryptor getInstance(String secretKey, String algorithm) {
        encryptor = new PooledPBEStringEncryptor();
        SimpleStringPBEConfig config = new SimpleStringPBEConfig();
        config.setPasswordCharArray(secretKey.toCharArray());
        config.setAlgorithm(algorithm);
        config.setKeyObtentionIterations("1");
        config.setSaltGenerator(new StringFixedSaltGenerator(salt));
        config.setIvGenerator(new StringFixedIvGenerator(iv));
        config.setPoolSize(1);
        config.setProviderName("SunJCE");
        config.setStringOutputType("base64");
        encryptor.setConfig(config);
        return encryptor;
    }

My dependency looks like this:

           <dependency>
                <groupId>com.github.ulisesbocchio</groupId>
                <artifactId>jasypt-spring-boot</artifactId>
                <version>3.0.5</version>
                <exclusions>
                    <exclusion>
                        <groupId>com.melloware</groupId>
                        <artifactId>jasypt</artifactId>
                    </exclusion>
                </exclusions>
            </dependency>

i tried to add: config.setIvGeneratorClassName("org.jasypt.iv.RandomIvGenerator"); but it didn't work
PI @ulisesbocchio can you help please because i saw that you know where this probleme come from.

@boufenzi boufenzi closed this as completed May 4, 2024
@boufenzi
Copy link
Author

boufenzi commented May 4, 2024

the solution is to override the configuration that were by default in previous version.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant