Skip to content

Commit

Permalink
Bug Fixes:
Browse files Browse the repository at this point in the history
- Resolved issues with default key password
  settings for PEM

Signed-off-by: Andrey Pleskach <[email protected]>
  • Loading branch information
willyborankin committed Aug 22, 2024
1 parent 00bc347 commit 83a6e67
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,8 @@
import io.netty.handler.ssl.ApplicationProtocolNegotiator;
import io.netty.handler.ssl.SslContext;

import static java.util.Objects.isNull;

final class KeyStoreUtils {

private final static class SecuritySslContext extends SslContext {
Expand Down Expand Up @@ -167,7 +169,7 @@ public static KeyStore keyStore(final Path certificateChainPath, final Path keyP
final var certificateChain = x509Certificates(certificateChainPath);
try {
final var keyStore = newKeyStore();
final var key = SecuritySslContext.toPrivateKey(keyPath.toFile(), new String(keyPassword));
final var key = SecuritySslContext.toPrivateKey(keyPath.toFile(), isNull(keyPassword) ? null : new String(keyPassword));
keyStore.setKeyEntry("key", key, keyPassword, certificateChain);
return keyStore;
} catch (Exception e) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -45,8 +45,6 @@ public class SslCertificatesLoader {

private final static Logger LOGGER = LogManager.getLogger(SslCertificatesLoader.class);

private final static char[] EMPTY_PASSWORD = new char[0];

private final String sslConfigSuffix;

private final String fullSslConfigSuffix;
Expand Down Expand Up @@ -114,7 +112,7 @@ private char[] resolvePassword(final String legacyPasswordSettings, final Settin
return legacyPassword.toCharArray();
}
}
return EMPTY_PASSWORD;
return null;
}

private KeyStoreConfiguration.JdkKeyStoreConfiguration buildJdkKeyStoreConfiguration(
Expand Down

0 comments on commit 83a6e67

Please sign in to comment.