diff --git a/extensions/vertx-http/runtime/src/main/java/io/quarkus/vertx/http/runtime/CertificateConfig.java b/extensions/vertx-http/runtime/src/main/java/io/quarkus/vertx/http/runtime/CertificateConfig.java index 21be315fadbef..544588de231a8 100644 --- a/extensions/vertx-http/runtime/src/main/java/io/quarkus/vertx/http/runtime/CertificateConfig.java +++ b/extensions/vertx-http/runtime/src/main/java/io/quarkus/vertx/http/runtime/CertificateConfig.java @@ -81,6 +81,12 @@ public class CertificateConfig { @ConfigItem public Optional keyStoreKeyAlias; + /** + * An optional parameter to define the password for the key, in case it's different from {@link #keyStorePassword}. + */ + @ConfigItem + public Optional keyStoreKeyPassword; + /** * An optional trust store which holds the certificate information of the certificates to trust. */ diff --git a/extensions/vertx-http/runtime/src/main/java/io/quarkus/vertx/http/runtime/VertxHttpRecorder.java b/extensions/vertx-http/runtime/src/main/java/io/quarkus/vertx/http/runtime/VertxHttpRecorder.java index 3b5f239e5ba38..6638552083ee2 100644 --- a/extensions/vertx-http/runtime/src/main/java/io/quarkus/vertx/http/runtime/VertxHttpRecorder.java +++ b/extensions/vertx-http/runtime/src/main/java/io/quarkus/vertx/http/runtime/VertxHttpRecorder.java @@ -622,7 +622,8 @@ private static HttpServerOptions createSslOptions(HttpBuildTimeConfig buildTimeC keystorePassword, sslConfig.certificate.keyStoreFileType, sslConfig.certificate.keyStoreProvider, - sslConfig.certificate.keyStoreKeyAlias); + sslConfig.certificate.keyStoreKeyAlias, + sslConfig.certificate.keyStoreKeyPassword); serverOptions.setKeyCertOptions(options); } else { return null; @@ -637,7 +638,8 @@ private static HttpServerOptions createSslOptions(HttpBuildTimeConfig buildTimeC trustStorePassword.get(), sslConfig.certificate.trustStoreFileType, sslConfig.certificate.trustStoreProvider, - sslConfig.certificate.trustStoreCertAlias); + sslConfig.certificate.trustStoreCertAlias, + Optional.empty()); serverOptions.setTrustOptions(options); } @@ -664,22 +666,23 @@ private static HttpServerOptions createSslOptions(HttpBuildTimeConfig buildTimeC return serverOptions; } - private static KeyStoreOptions createKeyStoreOptions(Path keyStorePath, String password, Optional keyStoreFileType, - Optional keyStoreProvider, Optional keyStoreAlias) throws IOException { + private static KeyStoreOptions createKeyStoreOptions(Path path, String password, Optional fileType, + Optional provider, Optional alias, Optional aliasPassword) throws IOException { final String type; - if (keyStoreFileType.isPresent()) { - type = keyStoreFileType.get().toLowerCase(); + if (fileType.isPresent()) { + type = fileType.get().toLowerCase(); } else { - type = findKeystoreFileType(keyStorePath); + type = findKeystoreFileType(path); } - byte[] data = getFileContent(keyStorePath); + byte[] data = getFileContent(path); KeyStoreOptions options = new KeyStoreOptions() .setPassword(password) .setValue(Buffer.buffer(data)) .setType(type.toUpperCase()) - .setProvider(keyStoreProvider.orElse(null)) - .setAlias(keyStoreAlias.orElse(null)); + .setProvider(provider.orElse(null)) + .setAlias(alias.orElse(null)) + .setAliasPassword(aliasPassword.orElse(null)); return options; } diff --git a/integration-tests/vertx-http/src/main/resources/application.properties b/integration-tests/vertx-http/src/main/resources/application.properties index d23f6c75671d7..dbdf680151b6e 100644 --- a/integration-tests/vertx-http/src/main/resources/application.properties +++ b/integration-tests/vertx-http/src/main/resources/application.properties @@ -2,6 +2,7 @@ vertx.event-loops.size=2 quarkus.http.ssl.certificate.key-store-file=server-keystore.jks quarkus.http.ssl.certificate.key-store-password=password quarkus.http.ssl.certificate.key-store-key-alias=server +quarkus.http.ssl.certificate.key-store-key-password=serverpw quarkus.http.ssl.certificate.trust-store-file=server-truststore.jks quarkus.http.ssl.certificate.trust-store-password=password quarkus.http.ssl.certificate.trust-store-cert-alias=mykey-1 diff --git a/integration-tests/vertx-http/src/main/resources/server-keystore.jks b/integration-tests/vertx-http/src/main/resources/server-keystore.jks index 76b41c403a610..c7ac8b12c43bf 100644 Binary files a/integration-tests/vertx-http/src/main/resources/server-keystore.jks and b/integration-tests/vertx-http/src/main/resources/server-keystore.jks differ