In my Java spring boot application, I’m using a P12 certificate and jks to connect to MQ for message reading & sending. the details of jks and p12 are stored & referred to via yml files. we need all passwords encrypted which, when I tried is throwing an error for p12 ( jks successful ).
ymlfiles are as such:
ssl:
key-store: file path of p12
key-password : password
key-store-password : password
trust-store-password: password
For client TLS Config, the class is calling the path, password as :
@value("$ssl.key-password}")
private String keypassword
similar for trust store password and keystore password
and to create ssl context :
@Bean
public SSLContext sslContext() {
SSLContext sslcont=SSLContextbuilder.create()
....
.keypassword.toCharArray().....build();
}
i introduced a decryption encryption class, encrypted the password in yml & changed above code to :
@Bean
public SSLContext sslContext() {
SSLContext sslcont=SSLContextbuilder.create()
....
.encryptor.decrypt(keypassword).toCharArray().....build();
}
sslContext Bean is in a @configuration class. should i autowire import the encryptor class inside the bean ? i suspect as it is a @value called detail, maybe somewhere inside the other beans in the class it is called as encrypted & thorws error ?
But i get below errors everytime:
keystore password was incorrect
badpaddingexception
I have rechecked the password, encryptions etc. Please help !