This is an automated email from the ASF dual-hosted git repository. dsoumis pushed a commit to branch 9.0.x in repository https://gitbox.apache.org/repos/asf/tomcat.git
commit 2ecf8c5a706be373d375075f3582a07d5a8c2a38 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 3520cd354c..2f1bd6351d 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.keyManagerMissing=No key manager found openssl.keyManagerMissing.warn=No key manager found. TLS will work but the certificate will not be visible to Tomcat so management/monitoring features will not work for this certificate diff --git a/java/org/apache/tomcat/util/net/openssl/OpenSSLContext.java b/java/org/apache/tomcat/util/net/openssl/OpenSSLContext.java index 47e21b6537..0ff156480c 100644 --- a/java/org/apache/tomcat/util/net/openssl/OpenSSLContext.java +++ b/java/org/apache/tomcat/util/net/openssl/OpenSSLContext.java @@ -599,6 +599,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)); + } StringBuilder sb = new StringBuilder(BEGIN_KEY); sb.append(Base64.getMimeEncoder(64, new byte[] { '\n' }).encodeToString(key.getEncoded())); sb.append(END_KEY); --------------------------------------------------------------------- To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected]
