This is an automated email from the ASF dual-hosted git repository.
markt pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/tomcat.git
The following commit(s) were added to refs/heads/main by this push:
new 4473967f06 Code clean-up - formatting. No functional change.
4473967f06 is described below
commit 4473967f060474f5ce4c48ddda776553a5b16a0b
Author: Mark Thomas <[email protected]>
AuthorDate: Thu May 22 17:32:37 2025 +0100
Code clean-up - formatting. No functional change.
---
.../tomcat/util/net/jsse/JSSEImplementation.java | 2 +-
.../tomcat/util/net/jsse/JSSEKeyManager.java | 32 +++++++---------
.../tomcat/util/net/jsse/JSSESSLContext.java | 3 +-
.../apache/tomcat/util/net/jsse/JSSESupport.java | 43 ++++++++++------------
java/org/apache/tomcat/util/net/jsse/JSSEUtil.java | 9 ++---
java/org/apache/tomcat/util/net/jsse/PEMFile.java | 10 ++---
6 files changed, 43 insertions(+), 56 deletions(-)
diff --git a/java/org/apache/tomcat/util/net/jsse/JSSEImplementation.java
b/java/org/apache/tomcat/util/net/jsse/JSSEImplementation.java
index 9ea9ce43d3..cc6ccfe332 100644
--- a/java/org/apache/tomcat/util/net/jsse/JSSEImplementation.java
+++ b/java/org/apache/tomcat/util/net/jsse/JSSEImplementation.java
@@ -43,7 +43,7 @@ public class JSSEImplementation extends SSLImplementation {
}
@Override
- public SSLSupport getSSLSupport(SSLSession session, Map<String,
List<String>> additionalAttributes) {
+ public SSLSupport getSSLSupport(SSLSession session,
Map<String,List<String>> additionalAttributes) {
return new JSSESupport(session, additionalAttributes);
}
diff --git a/java/org/apache/tomcat/util/net/jsse/JSSEKeyManager.java
b/java/org/apache/tomcat/util/net/jsse/JSSEKeyManager.java
index 5f63ba254e..04060565c8 100644
--- a/java/org/apache/tomcat/util/net/jsse/JSSEKeyManager.java
+++ b/java/org/apache/tomcat/util/net/jsse/JSSEKeyManager.java
@@ -26,9 +26,8 @@ import javax.net.ssl.X509ExtendedKeyManager;
import javax.net.ssl.X509KeyManager;
/**
- * X509KeyManager which allows selection of a specific key pair and certificate
- * chain (identified by their keystore alias name) to be used by the server to
- * authenticate itself to SSL clients.
+ * X509KeyManager which allows selection of a specific key pair and
certificate chain (identified by their keystore
+ * alias name) to be used by the server to authenticate itself to SSL clients.
*
* @author Jan Luehe
*/
@@ -41,9 +40,8 @@ public final class JSSEKeyManager extends
X509ExtendedKeyManager {
/**
* Constructor.
*
- * @param mgr The X509KeyManager used as a delegate
- * @param serverKeyAlias The alias name of the server's key pair and
- * supporting certificate chain
+ * @param mgr The X509KeyManager used as a delegate
+ * @param serverKeyAlias The alias name of the server's key pair and
supporting certificate chain
*/
public JSSEKeyManager(X509KeyManager mgr, String serverKeyAlias) {
super();
@@ -53,9 +51,8 @@ public final class JSSEKeyManager extends
X509ExtendedKeyManager {
/**
- * Returns the server key alias that was provided in the constructor or the
- * result from {@link X509KeyManager#chooseServerAlias(String, Principal[],
- * Socket)} for the delegate if no alias is specified.
+ * Returns the server key alias that was provided in the constructor or
the result from
+ * {@link X509KeyManager#chooseServerAlias(String, Principal[], Socket)}
for the delegate if no alias is specified.
*/
@Override
public String chooseServerAlias(String keyType, Principal[] issuers,
Socket socket) {
@@ -68,14 +65,13 @@ public final class JSSEKeyManager extends
X509ExtendedKeyManager {
/**
- * Returns the server key alias that was provided in the constructor or the
- * result from {@link
X509ExtendedKeyManager#chooseEngineServerAlias(String,
- * Principal[], SSLEngine)} for the delegate if no alias is specified.
+ * Returns the server key alias that was provided in the constructor or
the result from
+ * {@link X509ExtendedKeyManager#chooseEngineServerAlias(String,
Principal[], SSLEngine)} for the delegate if no
+ * alias is specified.
*/
@Override
- public String chooseEngineServerAlias(String keyType, Principal[] issuers,
- SSLEngine engine) {
- if (serverKeyAlias!=null) {
+ public String chooseEngineServerAlias(String keyType, Principal[] issuers,
SSLEngine engine) {
+ if (serverKeyAlias != null) {
return serverKeyAlias;
}
@@ -84,8 +80,7 @@ public final class JSSEKeyManager extends
X509ExtendedKeyManager {
@Override
- public String chooseClientAlias(String[] keyType, Principal[] issuers,
- Socket socket) {
+ public String chooseClientAlias(String[] keyType, Principal[] issuers,
Socket socket) {
return delegate.chooseClientAlias(keyType, issuers, socket);
}
@@ -115,8 +110,7 @@ public final class JSSEKeyManager extends
X509ExtendedKeyManager {
@Override
- public String chooseEngineClientAlias(String[] keyType, Principal[]
issuers,
- SSLEngine engine) {
+ public String chooseEngineClientAlias(String[] keyType, Principal[]
issuers, SSLEngine engine) {
return delegate.chooseClientAlias(keyType, issuers, null);
}
}
diff --git a/java/org/apache/tomcat/util/net/jsse/JSSESSLContext.java
b/java/org/apache/tomcat/util/net/jsse/JSSESSLContext.java
index ac058faf21..088257110b 100644
--- a/java/org/apache/tomcat/util/net/jsse/JSSESSLContext.java
+++ b/java/org/apache/tomcat/util/net/jsse/JSSESSLContext.java
@@ -46,8 +46,7 @@ class JSSESSLContext implements SSLContext {
}
@Override
- public void init(KeyManager[] kms, TrustManager[] tms, SecureRandom sr)
- throws KeyManagementException {
+ public void init(KeyManager[] kms, TrustManager[] tms, SecureRandom sr)
throws KeyManagementException {
this.kms = kms;
this.tms = tms;
context.init(kms, tms, sr);
diff --git a/java/org/apache/tomcat/util/net/jsse/JSSESupport.java
b/java/org/apache/tomcat/util/net/jsse/JSSESupport.java
index da0decc95e..d2591f519d 100644
--- a/java/org/apache/tomcat/util/net/jsse/JSSESupport.java
+++ b/java/org/apache/tomcat/util/net/jsse/JSSESupport.java
@@ -36,13 +36,10 @@ import org.apache.tomcat.util.net.openssl.ciphers.Cipher;
import org.apache.tomcat.util.res.StringManager;
/**
- * JSSESupport.
- * Concrete implementation class for JSSE Support classes.
+ * JSSESupport. Concrete implementation class for JSSE Support classes.
*
* @author EKR
- * @author Craig R. McClanahan
- * Parts cribbed from JSSECertCompat
- * Parts cribbed from CertificatesValve
+ * @author Craig R. McClanahan Parts cribbed from JSSECertCompat Parts cribbed
from CertificatesValve
*/
public class JSSESupport implements SSLSupport, SSLSessionManager {
@@ -61,9 +58,8 @@ public class JSSESupport implements SSLSupport,
SSLSessionManager {
}
/*
- * NO-OP method provided to make it easy for other classes in this package
- * to trigger the loading of this class and the population of the
- * keySizeCache.
+ * NO-OP method provided to make it easy for other classes in this package
to trigger the loading of this class and
+ * the population of the keySizeCache.
*/
static void init() {
// NO-OP
@@ -101,10 +97,10 @@ public class JSSESupport implements SSLSupport,
SSLSessionManager {
return null;
}
- Certificate [] certs;
+ Certificate[] certs;
try {
certs = session.getPeerCertificates();
- } catch( Throwable t ) {
+ } catch (Throwable t) {
log.debug(sm.getString("jsseSupport.clientCertError"), t);
return null;
}
@@ -114,31 +110,31 @@ public class JSSESupport implements SSLSupport,
SSLSessionManager {
private static X509Certificate[] convertCertificates(Certificate[] certs) {
- if( certs==null ) {
+ if (certs == null) {
return null;
}
- X509Certificate [] x509Certs = new X509Certificate[certs.length];
- for(int i=0; i < certs.length; i++) {
- if (certs[i] instanceof X509Certificate ) {
+ X509Certificate[] x509Certs = new X509Certificate[certs.length];
+ for (int i = 0; i < certs.length; i++) {
+ if (certs[i] instanceof X509Certificate) {
// always currently true with the JSSE 1.1.x
x509Certs[i] = (X509Certificate) certs[i];
} else {
try {
- byte [] buffer = certs[i].getEncoded();
+ byte[] buffer = certs[i].getEncoded();
CertificateFactory cf =
CertificateFactory.getInstance("X.509");
ByteArrayInputStream stream = new
ByteArrayInputStream(buffer);
x509Certs[i] = (X509Certificate)
cf.generateCertificate(stream);
- } catch(Exception ex) {
+ } catch (Exception ex) {
log.info(sm.getString("jsseSupport.certTranslationError",
certs[i]), ex);
return null;
}
}
- if(log.isTraceEnabled()) {
+ if (log.isTraceEnabled()) {
log.trace("Cert #" + i + " = " + x509Certs[i]);
}
}
- if(x509Certs.length < 1) {
+ if (x509Certs.length < 1) {
return null;
}
return x509Certs;
@@ -161,18 +157,17 @@ public class JSSESupport implements SSLSupport,
SSLSessionManager {
}
@Override
- public String getSessionId()
- throws IOException {
+ public String getSessionId() throws IOException {
// Look up the current SSLSession
if (session == null) {
return null;
}
// Expose ssl_session (getId)
- byte [] ssl_session = session.getId();
+ byte[] ssl_session = session.getId();
if (ssl_session == null || ssl_session.length == 0) {
return null;
}
- StringBuilder buf=new StringBuilder();
+ StringBuilder buf = new StringBuilder();
for (byte b : ssl_session) {
String digit = Integer.toHexString(b);
if (digit.length() < 2) {
@@ -203,9 +198,9 @@ public class JSSESupport implements SSLSupport,
SSLSessionManager {
@Override
public String getProtocol() throws IOException {
if (session == null) {
- return null;
+ return null;
}
- return session.getProtocol();
+ return session.getProtocol();
}
@Override
diff --git a/java/org/apache/tomcat/util/net/jsse/JSSEUtil.java
b/java/org/apache/tomcat/util/net/jsse/JSSEUtil.java
index a8b3cf7b3c..5a83584691 100644
--- a/java/org/apache/tomcat/util/net/jsse/JSSEUtil.java
+++ b/java/org/apache/tomcat/util/net/jsse/JSSEUtil.java
@@ -52,12 +52,12 @@ public class JSSEUtil extends SSLUtilBase {
private volatile Set<String> implementedCiphers;
- public JSSEUtil (SSLHostConfigCertificate certificate) {
+ public JSSEUtil(SSLHostConfigCertificate certificate) {
this(certificate, true);
}
- public JSSEUtil (SSLHostConfigCertificate certificate, boolean warnOnSkip)
{
+ public JSSEUtil(SSLHostConfigCertificate certificate, boolean warnOnSkip) {
super(certificate, warnOnSkip);
}
@@ -90,8 +90,7 @@ public class JSSEUtil extends SSLUtilBase {
@Override
- public SSLContext createSSLContextInternal(List<String>
negotiableProtocols)
- throws NoSuchAlgorithmException {
+ public SSLContext createSSLContextInternal(List<String>
negotiableProtocols) throws NoSuchAlgorithmException {
return new JSSESSLContext(sslHostConfig.getSslProtocol());
}
@@ -103,7 +102,7 @@ public class JSSEUtil extends SSLUtilBase {
SSLContext context;
try {
context = new
JSSESSLContext(sslHostConfig.getSslProtocol());
- context.init(null, null, null);
+ context.init(null, null, null);
} catch (NoSuchAlgorithmException | KeyManagementException
e) {
// This is fatal for the connector so throw an
exception to prevent
// it from starting
diff --git a/java/org/apache/tomcat/util/net/jsse/PEMFile.java
b/java/org/apache/tomcat/util/net/jsse/PEMFile.java
index 930a7e1026..f380c385b0 100644
--- a/java/org/apache/tomcat/util/net/jsse/PEMFile.java
+++ b/java/org/apache/tomcat/util/net/jsse/PEMFile.java
@@ -107,10 +107,9 @@ public class PEMFile {
}
public static String toPEM(X509Certificate certificate) throws
CertificateEncodingException {
- return Part.BEGIN_BOUNDARY + Part.CERTIFICATE + Part.FINISH_BOUNDARY +
- System.lineSeparator() +
-
Base64.getMimeEncoder().encodeToString(certificate.getEncoded()) +
- Part.END_BOUNDARY + Part.CERTIFICATE + Part.FINISH_BOUNDARY;
+ return Part.BEGIN_BOUNDARY + Part.CERTIFICATE + Part.FINISH_BOUNDARY +
System.lineSeparator() +
+
Base64.getMimeEncoder().encodeToString(certificate.getEncoded()) +
Part.END_BOUNDARY +
+ Part.CERTIFICATE + Part.FINISH_BOUNDARY;
}
private final List<X509Certificate> certificates = new ArrayList<>();
@@ -412,7 +411,8 @@ public class PEMFile {
byte[] oidPRF = p.parseOIDAsBytes();
prf = OID_TO_PRF.get(HexUtils.toHexString(oidPRF));
if (prf == null) {
- throw new
NoSuchAlgorithmException(sm.getString("pemFile.unknownPrfAlgorithm",
toDottedOidString(oidPRF)));
+ throw new NoSuchAlgorithmException(
+
sm.getString("pemFile.unknownPrfAlgorithm", toDottedOidString(oidPRF)));
}
p.parseNull();
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]