Skip to content

Commit

Permalink
netty: Add support for IBMJSSE2 (#7422)
Browse files Browse the repository at this point in the history
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
  • Loading branch information
kiwi1969 committed Sep 16, 2020
1 parent ee5b592 commit 5879b53
Showing 1 changed file with 13 additions and 1 deletion.
14 changes: 13 additions & 1 deletion netty/src/main/java/io/grpc/netty/GrpcSslContexts.java
Expand Up @@ -82,6 +82,7 @@ private GrpcSslContexts() {}
NEXT_PROTOCOL_VERSIONS);

private static final String SUN_PROVIDER_NAME = "SunJSSE";
private static final String IBM_PROVIDER_NAME = "IBMJSSE2";

/**
* Creates an SslContextBuilder with ciphers and APN appropriate for gRPC.
Expand Down Expand Up @@ -196,7 +197,14 @@ public static SslContextBuilder configure(SslContextBuilder builder, Provider jd
apc = ALPN;
} else {
throw new IllegalArgumentException(
SUN_PROVIDER_NAME + " selected, but Java 9+ and Jetty NPN/ALPN unavailable");
jdkProvider.getName() + " selected, but Java 9+ and Jetty NPN/ALPN unavailable");
}
} else if (IBM_PROVIDER_NAME.equals(jdkProvider.getName())) {
if (JettyTlsUtil.isJava9AlpnAvailable()) {
apc = ALPN;
} else {
throw new IllegalArgumentException(
jdkProvider.getName() + " selected, but Java 9+ ALPN unavailable");
}
} else if (ConscryptLoader.isConscrypt(jdkProvider)) {
apc = ALPN;
Expand Down Expand Up @@ -243,6 +251,10 @@ private static Provider findJdkProvider() {
|| JettyTlsUtil.isJava9AlpnAvailable()) {
return provider;
}
} else if (IBM_PROVIDER_NAME.equals(provider.getName())) {
if (JettyTlsUtil.isJava9AlpnAvailable()) {
return provider;
}
} else if (ConscryptLoader.isConscrypt(provider)) {
return provider;
}
Expand Down

0 comments on commit 5879b53

Please sign in to comment.