This is an automated email from the ASF dual-hosted git repository. dsoumis pushed a commit to branch 11.0.x in repository https://gitbox.apache.org/repos/asf/tomcat.git
commit b3dd023e5c0c4aef96bd51d7cefb69084e6afdd0 Author: Dimitris Soumis <[email protected]> AuthorDate: Fri Oct 30 14:16:42 2026 +0200 Align behavior with Panama --- java/org/apache/tomcat/util/net/openssl/LocalStrings.properties | 1 + java/org/apache/tomcat/util/net/openssl/OpenSSLContext.java | 3 +++ 2 files changed, 4 insertions(+) diff --git a/java/org/apache/tomcat/util/net/openssl/LocalStrings.properties b/java/org/apache/tomcat/util/net/openssl/LocalStrings.properties index 86efb9c01a..091bf19b9c 100644 --- a/java/org/apache/tomcat/util/net/openssl/LocalStrings.properties +++ b/java/org/apache/tomcat/util/net/openssl/LocalStrings.properties @@ -48,6 +48,7 @@ openssl.doubleInit=SSL context already initialized, ignoring openssl.errApplyConf=Could not apply OpenSSLConf to SSL context openssl.errCheckConf=Error during OpenSSLConf check openssl.errMakeConf=Could not create OpenSSLConf context +openssl.errorLoadingCertificate=Error loading certificate: [{0}] openssl.errorSSLCtxInit=Error initializing SSL context openssl.failSslContextMake=Unable to create SSLContext. Check that SSLEngine is enabled in the AprLifecycleListener, the AprLifecycleListener has initialised correctly and that a valid SSLProtocol has been specified openssl.invalidSslProtocol=An invalid value [{0}] was provided for the SSLProtocol attribute diff --git a/java/org/apache/tomcat/util/net/openssl/OpenSSLContext.java b/java/org/apache/tomcat/util/net/openssl/OpenSSLContext.java index cc764adc09..ba22389783 100644 --- a/java/org/apache/tomcat/util/net/openssl/OpenSSLContext.java +++ b/java/org/apache/tomcat/util/net/openssl/OpenSSLContext.java @@ -579,6 +579,9 @@ public class OpenSSLContext implements org.apache.tomcat.util.net.SSLContext { String alias = getServedAlias(certificate); X509Certificate[] chain = x509KeyManager.getCertificateChain(alias); PrivateKey key = x509KeyManager.getPrivateKey(alias); + if (key == null || key.getEncoded() == null || chain == null || chain.length == 0) { + throw new SSLException(sm.getString("openssl.errorLoadingCertificate", alias)); + } String encodedKey = BEGIN_KEY + Base64.getMimeEncoder(64, new byte[] { '\n' }).encodeToString(key.getEncoded()) + END_KEY; SSLContext.setCertificateRaw(state.ctx, chain[0].getEncoded(), --------------------------------------------------------------------- To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected]
