Skip to content

Commit 2709426

Browse files
hasnain-dbMridul Muralidharan
authored andcommitted
[SPARK-45541][CORE] Add SSLFactory
### What changes were proposed in this pull request? As titled - add a factory which supports creating SSL engines, and a corresponding builder for it. This will be used in a follow up PR by the `TransportContext` and related files to add SSL support. ### Why are the changes needed? We need a mechanism to initialize the appropriate SSL implementation with the configured settings (such as protocol, ciphers, etc) for RPC SSL support. ### Does this PR introduce _any_ user-facing change? No ### How was this patch tested? existing tests. This will be more thoroughly tested in a follow up PR which adds callsites to it. It has been integration tested as part of #42685 ### Was this patch authored or co-authored using generative AI tooling? No Closes #43386 from hasnain-db/spark-tls-factory. Authored-by: Hasnain Lakhani <hasnain.lakhani@databricks.com> Signed-off-by: Mridul Muralidharan <mridul<at>gmail.com>
1 parent 936e98d commit 2709426

File tree

3 files changed

+474
-3
lines changed

3 files changed

+474
-3
lines changed

common/network-common/src/main/java/org/apache/spark/network/protocol/SslMessageEncoder.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@
3636
@ChannelHandler.Sharable
3737
public final class SslMessageEncoder extends MessageToMessageEncoder<Message> {
3838

39-
private final Logger logger = LoggerFactory.getLogger(SslMessageEncoder.class);
39+
private static final Logger logger = LoggerFactory.getLogger(SslMessageEncoder.class);
4040

4141
private SslMessageEncoder() {}
4242

common/network-common/src/main/java/org/apache/spark/network/ssl/ReloadingX509TrustManager.java

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@
4646
public final class ReloadingX509TrustManager
4747
implements X509TrustManager, Runnable {
4848

49-
private final Logger logger = LoggerFactory.getLogger(ReloadingX509TrustManager.class);
49+
private static final Logger logger = LoggerFactory.getLogger(ReloadingX509TrustManager.class);
5050

5151
private final String type;
5252
private final File file;
@@ -180,7 +180,8 @@ X509TrustManager loadTrustManager()
180180
canonicalPath = latestCanonicalFile.getPath();
181181
lastLoaded = latestCanonicalFile.lastModified();
182182
try (FileInputStream in = new FileInputStream(latestCanonicalFile)) {
183-
ks.load(in, password.toCharArray());
183+
char[] passwordCharacters = password != null? password.toCharArray() : null;
184+
ks.load(in, passwordCharacters);
184185
logger.debug("Loaded truststore '" + file + "'");
185186
}
186187

0 commit comments

Comments
 (0)