Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -42,17 +42,19 @@ public SSLContext createSSLContext() throws GeneralSecurityException, IOExceptio
char[] keyPassword = properties.keyPassword();
KeyStore keyStore = createKeyStore();

try {
builder.loadKeyMaterial(keyStore, keyPassword);
}
catch (UnrecoverableKeyException e) {
if (keyPassword.length == 0) {
// Retry if empty password, see
// https://rt.openssl.org/Ticket/Display.html?id=1497&user=guest&pass=guest
builder.loadKeyMaterial(keyStore, new char[] { '\0' });
if (keyStore != null) {
try {
builder.loadKeyMaterial(keyStore, keyPassword);
}
else {
throw e;
catch (UnrecoverableKeyException e) {
if (keyPassword.length == 0) {
// Retry if empty password, see
// https://rt.openssl.org/Ticket/Display.html?id=1497&user=guest&pass=guest
builder.loadKeyMaterial(keyStore, new char[] { '\0' });
}
else {
throw e;
}
}
}

Expand All @@ -66,7 +68,7 @@ public SSLContext createSSLContext() throws GeneralSecurityException, IOExceptio

public KeyStore createKeyStore() throws GeneralSecurityException, IOException {
if (properties.getKeyStore() == null) {
throw new KeyStoreException("Keystore not specified.");
return null;
}
if (!properties.getKeyStore().exists()) {
throw new KeyStoreException("Keystore not exists: " + properties.getKeyStore());
Expand Down