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 fails to bind properties 'spring.datasource.password' while using with ENC() #371

Open
susheelamohan opened this issue Sep 5, 2023 · 1 comment

Comments

@susheelamohan
Copy link

we upgraded spring boot version to 2.7.7 from 2.1.x , when we use

spring.datasource.password=${datasource_password:ENC(xxxxxxxxxxxxxxxx)} it fails to get a DBconnection.

However, with clear text in password, it works.

Did some search on the web and tried most of the suggestions as below:

  1. upgrading/downgrading maven dependency jasypt-spring-boot-starter version 3.x , 2.0.0
  2. passing -Djasypt.encryptor.password= OR -DJASYPT_ENCRYPTOR_PASSWORD= as JVM argument
  3. setting spring.datasource.password=ENC(encrypted_password)
  4. Have also tried setting the combinations of these
    jasypt.encryptor.iv-generator-classname=org.jasypt.iv.NoIvGenerator
    Default algorithm : jasypt.encryptor.algorithm=PBEWithMD5AndDES
    jasypt.encryptor.iv-generator-classname=org.jasypt.iv.NoIvGenerator
    org.jasypt.salt.RandomSaltGenerator
  5. with/out provider and classname.

it was working with 2.1.x and jasypt 1.18,
The provider as BC, clasname : org.bouncycastle.jce.provider.BouncyCastleProvider
jasypt.encryptor.algorithm=${encryption_algorithm:PBEWITHSHAAND256BITAES-CBC-BC}
jasypt.encryptor.provider=BC

Any pointers on this are highly appreciated.

@LemmingAvalanche
Copy link

We had a similar problem. Upgrading from 3.0.4 to 3.0.5 worked for us.

We also had to add @EnableEncryptableProperties to all application classes (classes with @SpringBootApplication).

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

2 participants