1 year ago
#331803
Jin Ma
How can I encrypt multiple passwords to access multiple instances?
In the application.yml
file for my Spring Boot application, I'd like to define multiple instances of a service and in order to query each service, I'd have to use different tokens. These tokens are encrypted with Jasypt for protection.
The application.yml
looks like this:
service:
urls:
https://url1,
https://url2
authorizations:
ENC(encrypted_token1),
ENC(encrypted_token2)
And I use:
@Value("${service.urls}")
String[] urls;
@Value("${service.authorizations}")
String[] authorizations;
However this causes an exception when my application starts
Injection of autowired dependencies failed: nested exception is com.ulisesbocchio.jasyptsprintboot.exception.DescryptionException: Decryption of Properties failed, make sure encryption/decryption passwords match
I'm pretty sure the encryption and decryption was properly done because if I change the multiple URL values and tokens to just one URL and one token, everything works.
spring-boot
encryption
yaml
jasypt
0 Answers
Your Answer