-
Notifications
You must be signed in to change notification settings - Fork 41.4k
Description
Background
We have a custom component for watching for changes on PEM files and reloading some components such as tomcat.
We are using PemSslStoreBundle
to load the PEM files into keystores. This class has a limitation of not allowing to specify the key password: it is always null.
Problem
Tomcat currently cannot pickup null key passwords: if the key password is null, it'll attempt to use the keystore password and consequently fail to load the keys. See: SSLUtilBase.
Even though the limitation should be fixed on tomcat, other 3pp components could have a similar issue, hence it would be great to improve this algorithm to take the key password as parameter.
Workaround
A workaround for this case is to provide tomcat an empty string password: tomcat will use the empty string to load the keys, and surprisingly keyStore.getKey("alias", "".toCharArray())
works for keys saved with null password on Open JDK 17, however it looks like an odd undocumented behavior which may not work on future versions.