Issue #901 - Overriding SSL context KeyStoreType requires explicit override of TrustStoreType.

Improved defaulting values for the truststore, avoiding to default
the password, which is often missing for a truststore.

Signed-off-by: Simone Bordet <simone.bordet@gmail.com>
This commit is contained in:
Simone Bordet 2018-06-08 17:40:23 +02:00
parent 23fa0303a6
commit 5165b082b5
1 changed files with 7 additions and 3 deletions

View File

@ -1082,10 +1082,14 @@ public class SslContextFactory extends AbstractLifeCycle implements Dumpable
{
String type = Objects.toString(getTrustStoreType(), getKeyStoreType());
String provider = Objects.toString(getTrustStoreProvider(), getKeyStoreProvider());
String passwd = Objects.toString(_trustStorePassword, Objects.toString(_keyStorePassword, null));
if (resource == null)
Password passwd = _trustStorePassword;
if (resource == null || resource.equals(_keyStoreResource))
{
resource = _keyStoreResource;
return CertificateUtils.getKeyStore(resource, type, provider, passwd);
if (passwd == null)
passwd = _keyStorePassword;
}
return CertificateUtils.getKeyStore(resource, type, provider, Objects.toString(passwd, null));
}
/**