Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 5879b53

Browse files
authored
netty: Add support for IBMJSSE2 (#7422)
This is a very simple change to test for IBMJSSE2 security provider in addition to the others. IBM JRE does not support the Sun provider, but instead has IBMJSSE2 which supports the same API calls. I tested this on Z/OS machine as now it works when before it couldn't find a security provider
1 parent ee5b592 commit 5879b53

File tree

1 file changed

+13
-1
lines changed

1 file changed

+13
-1
lines changed

netty/src/main/java/io/grpc/netty/GrpcSslContexts.java

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -82,6 +82,7 @@ private GrpcSslContexts() {}
8282
NEXT_PROTOCOL_VERSIONS);
8383

8484
private static final String SUN_PROVIDER_NAME = "SunJSSE";
85+
private static final String IBM_PROVIDER_NAME = "IBMJSSE2";
8586

8687
/**
8788
* Creates an SslContextBuilder with ciphers and APN appropriate for gRPC.
@@ -196,7 +197,14 @@ public static SslContextBuilder configure(SslContextBuilder builder, Provider jd
196197
apc = ALPN;
197198
} else {
198199
throw new IllegalArgumentException(
199-
SUN_PROVIDER_NAME + " selected, but Java 9+ and Jetty NPN/ALPN unavailable");
200+
jdkProvider.getName() + " selected, but Java 9+ and Jetty NPN/ALPN unavailable");
201+
}
202+
} else if (IBM_PROVIDER_NAME.equals(jdkProvider.getName())) {
203+
if (JettyTlsUtil.isJava9AlpnAvailable()) {
204+
apc = ALPN;
205+
} else {
206+
throw new IllegalArgumentException(
207+
jdkProvider.getName() + " selected, but Java 9+ ALPN unavailable");
200208
}
201209
} else if (ConscryptLoader.isConscrypt(jdkProvider)) {
202210
apc = ALPN;
@@ -243,6 +251,10 @@ private static Provider findJdkProvider() {
243251
|| JettyTlsUtil.isJava9AlpnAvailable()) {
244252
return provider;
245253
}
254+
} else if (IBM_PROVIDER_NAME.equals(provider.getName())) {
255+
if (JettyTlsUtil.isJava9AlpnAvailable()) {
256+
return provider;
257+
}
246258
} else if (ConscryptLoader.isConscrypt(provider)) {
247259
return provider;
248260
}

0 commit comments

Comments
 (0)