BouncyCastleAlpnSslUtils Class — netty Architecture
Architecture documentation for the BouncyCastleAlpnSslUtils class in BouncyCastleAlpnSslUtils.java from the netty codebase.
Entity Profile
Dependency Diagram
graph TD 49900df4_31cd_ac6b_00c5_ebef487f1fd0["BouncyCastleAlpnSslUtils"] 5f4ef8e8_10e5_80ad_1385_81c45c088419["BouncyCastleAlpnSslUtils.java"] 49900df4_31cd_ac6b_00c5_ebef487f1fd0 -->|defined in| 5f4ef8e8_10e5_80ad_1385_81c45c088419 d4a5fd64_87e0_1d84_d57e_dcd2505e2789["BouncyCastleAlpnSslUtils()"] 49900df4_31cd_ac6b_00c5_ebef487f1fd0 -->|method| d4a5fd64_87e0_1d84_d57e_dcd2505e2789 dcabf5ab_46b8_0753_1f56_25f6c7a890c8["String()"] 49900df4_31cd_ac6b_00c5_ebef487f1fd0 -->|method| dcabf5ab_46b8_0753_1f56_25f6c7a890c8 a787f823_debc_d76b_f2a1_91124a1bae37["setApplicationProtocols()"] 49900df4_31cd_ac6b_00c5_ebef487f1fd0 -->|method| a787f823_debc_d76b_f2a1_91124a1bae37 2f4771f4_339a_6208_4f82_6849dcdd6756["setHandshakeApplicationProtocolSelector()"] 49900df4_31cd_ac6b_00c5_ebef487f1fd0 -->|method| 2f4771f4_339a_6208_4f82_6849dcdd6756 73c61fdf_beb3_09f6_77a0_50b91375bddd["getHandshakeApplicationProtocolSelector()"] 49900df4_31cd_ac6b_00c5_ebef487f1fd0 -->|method| 73c61fdf_beb3_09f6_77a0_50b91375bddd b1d88958_e309_71c6_0266_b181a1b417c1["isAlpnSupported()"] 49900df4_31cd_ac6b_00c5_ebef487f1fd0 -->|method| b1d88958_e309_71c6_0266_b181a1b417c1
Relationship Graph
Source Code
handler/src/main/java/io/netty/handler/ssl/BouncyCastleAlpnSslUtils.java lines 38–242
final class BouncyCastleAlpnSslUtils {
private static final InternalLogger logger = InternalLoggerFactory.getInstance(BouncyCastleAlpnSslUtils.class);
private static final Method SET_APPLICATION_PROTOCOLS;
private static final Method GET_APPLICATION_PROTOCOL;
private static final Method GET_HANDSHAKE_APPLICATION_PROTOCOL;
private static final Method SET_HANDSHAKE_APPLICATION_PROTOCOL_SELECTOR;
private static final Method GET_HANDSHAKE_APPLICATION_PROTOCOL_SELECTOR;
private static final Class<?> BC_APPLICATION_PROTOCOL_SELECTOR;
private static final Method BC_APPLICATION_PROTOCOL_SELECTOR_SELECT;
private static final boolean SUPPORTED;
static {
Method setApplicationProtocols;
Method getApplicationProtocol;
Method getHandshakeApplicationProtocol;
Method setHandshakeApplicationProtocolSelector;
Method getHandshakeApplicationProtocolSelector;
Method bcApplicationProtocolSelectorSelect;
Class<?> bcApplicationProtocolSelector;
boolean supported;
try {
if (!BouncyCastleUtil.isBcTlsAvailable()) {
throw new IllegalStateException(BouncyCastleUtil.unavailabilityCauseBcTls());
}
SSLContext context = getSSLContext(BouncyCastleUtil.getBcProviderJsse(), new SecureRandom());
SSLEngine engine = context.createSSLEngine();
Class<? extends SSLEngine> engineClass = engine.getClass();
// We need to use the class returned by BounceCastleUtil below to access the methods as the engine
// returned by createSSLEngine might be package-private and so would not allow us to access the methods
// even thought the interface itself that it implements is public and so the methods are public.
// See https://github.com/netty/netty/issues/15627
final Class<? extends SSLEngine> bcEngineClass = BouncyCastleUtil.getBcSSLEngineClass();
if (bcEngineClass == null || !bcEngineClass.isAssignableFrom(engineClass)) {
throw new IllegalStateException("Unexpected engine class: " + engineClass);
}
final SSLParameters bcSslParameters = engine.getSSLParameters();
final Class<?> bCSslParametersClass = bcSslParameters.getClass();
setApplicationProtocols = AccessController.doPrivileged(new PrivilegedExceptionAction<Method>() {
@Override
public Method run() throws Exception {
return bCSslParametersClass.getMethod("setApplicationProtocols", String[].class);
}
});
setApplicationProtocols.invoke(bcSslParameters, new Object[]{EmptyArrays.EMPTY_STRINGS});
getApplicationProtocol = AccessController.doPrivileged(new PrivilegedExceptionAction<Method>() {
@Override
public Method run() throws Exception {
return bcEngineClass.getMethod("getApplicationProtocol");
}
});
getApplicationProtocol.invoke(engine);
getHandshakeApplicationProtocol = AccessController.doPrivileged(new PrivilegedExceptionAction<Method>() {
@Override
public Method run() throws Exception {
return bcEngineClass.getMethod("getHandshakeApplicationProtocol");
}
});
getHandshakeApplicationProtocol.invoke(engine);
final Class<?> testBCApplicationProtocolSelector = Class.forName(
"org.bouncycastle.jsse.BCApplicationProtocolSelector", true, engineClass.getClassLoader());
bcApplicationProtocolSelector = testBCApplicationProtocolSelector;
bcApplicationProtocolSelectorSelect = AccessController.doPrivileged(
new PrivilegedExceptionAction<Method>() {
@Override
public Method run() throws Exception {
return testBCApplicationProtocolSelector.getMethod("select", Object.class, List.class);
}
});
setHandshakeApplicationProtocolSelector =
AccessController.doPrivileged(new PrivilegedExceptionAction<Method>() {
@Override
public Method run() throws Exception {
return bcEngineClass.getMethod("setBCHandshakeApplicationProtocolSelector",
testBCApplicationProtocolSelector);
Source
Frequently Asked Questions
What is the BouncyCastleAlpnSslUtils class?
BouncyCastleAlpnSslUtils is a class in the netty codebase, defined in handler/src/main/java/io/netty/handler/ssl/BouncyCastleAlpnSslUtils.java.
Where is BouncyCastleAlpnSslUtils defined?
BouncyCastleAlpnSslUtils is defined in handler/src/main/java/io/netty/handler/ssl/BouncyCastleAlpnSslUtils.java at line 38.
Analyze Your Own Codebase
Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.
Try Supermodel Free