ulisesbocchio / jasypt-spring-boot

Jasypt integration for Spring boot
MIT License
2.87k stars 514 forks source link

Multiple property decryption #368

Open raviraja opened 1 year ago

raviraja commented 1 year ago

Hi, In my project i pass an encrypted secret to the application as below In application.properties

secret=ENC(encryptedValue)

and in my application code i read it as

@Value("${secret}")
private String secret

this setup works perfectly fine.

Now we want to read multiple encrypted values from the same property as something like

@Value("${secret}")
private String[] secrets

What is the correct way to pass the encrypted values in .proprties file? we tried a few combinations like

secret = ENC(encryptedValue1), ENC(encryptedValue2)

or

secret = ENC(encryptedValue1,encryptedValue2)

but none of them work.!!

Is it possible to achieve this out of the box, if yes how should the properties be defined? if no, what is the custom logic that's needed?