This is an automated email from the ASF dual-hosted git repository. dsoumis pushed a commit to branch 10.1.x in repository https://gitbox.apache.org/repos/asf/tomcat.git
commit faefc134aab07d4b756066542a671886e8b18ff4 Author: Dimitris Soumis <[email protected]> AuthorDate: Thu Oct 29 18:17:56 2026 +0200 Skip key entries without a server-auth X.509 certificate when auto-selecting --- java/org/apache/tomcat/util/net/SSLUtilBase.java | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/java/org/apache/tomcat/util/net/SSLUtilBase.java b/java/org/apache/tomcat/util/net/SSLUtilBase.java index 876abb5735..06f9a946b8 100644 --- a/java/org/apache/tomcat/util/net/SSLUtilBase.java +++ b/java/org/apache/tomcat/util/net/SSLUtilBase.java @@ -407,15 +407,17 @@ public abstract class SSLUtilBase implements SSLUtil { if (!ks.isKeyEntry(candidate)) { continue; } + // Select only a key entry with an X.509 certificate valid for server authentication. A non-X.509 + // or absent certificate cannot be validated or serve TLS, so skip it rather than prefer it. Certificate cert = ks.getCertificate(candidate); - if (cert instanceof X509Certificate && !isServerAuthCapable((X509Certificate) cert)) { + if (cert instanceof X509Certificate && isServerAuthCapable((X509Certificate) cert)) { + keyAlias = candidate; + } else { if (log.isDebugEnabled()) { log.debug(sm.getString("sslUtilBase.skippedKeyUsage", candidate)); } skippedForServerAuth = true; - continue; } - keyAlias = candidate; } if (keyAlias == null) { if (skippedForServerAuth) { --------------------------------------------------------------------- To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected]
