testMasterKeyLogging() — netty Function Reference
Architecture documentation for the testMasterKeyLogging() function in SSLEngineTest.java from the netty codebase.
Entity Profile
Dependency Diagram
graph TD f0bf4c59_41da_0bdc_86d0_d866b6e74889["testMasterKeyLogging()"] 9150c92a_2afc_b83a_c3bf_86dfac6e9d9b["SSLEngineTest"] f0bf4c59_41da_0bdc_86d0_d866b6e74889 -->|defined in| 9150c92a_2afc_b83a_c3bf_86dfac6e9d9b bf19737b_7dc7_9dfd_0a67_ae31448ebbe8["protocols()"] f0bf4c59_41da_0bdc_86d0_d866b6e74889 -->|calls| bf19737b_7dc7_9dfd_0a67_ae31448ebbe8 e3b541e6_b593_4b1f_a637_da19020e73df["ciphers()"] f0bf4c59_41da_0bdc_86d0_d866b6e74889 -->|calls| e3b541e6_b593_4b1f_a637_da19020e73df d074ce38_190b_dae8_46f6_82b7c5e7ecaf["TestByteBufAllocator()"] f0bf4c59_41da_0bdc_86d0_d866b6e74889 -->|calls| d074ce38_190b_dae8_46f6_82b7c5e7ecaf 13aca077_a788_4333_9f8b_2b1437653846["delegate()"] f0bf4c59_41da_0bdc_86d0_d866b6e74889 -->|calls| 13aca077_a788_4333_9f8b_2b1437653846 style f0bf4c59_41da_0bdc_86d0_d866b6e74889 fill:#6366f1,stroke:#818cf8,color:#fff
Relationship Graph
Source Code
handler/src/test/java/io/netty/handler/ssl/SSLEngineTest.java lines 4520–4594
@MethodSource("newTestParams")
@ParameterizedTest
public void testMasterKeyLogging(final SSLEngineTestParam param) throws Exception {
if (param.combo() != ProtocolCipherCombo.tlsv12()) {
return;
}
/*
* At the moment master key logging is not supported for conscrypt
*/
assumeFalse(serverSslContextProvider() instanceof OpenSSLProvider);
/*
* The JDK SSL engine master key retrieval relies on being able to set field access to true.
* That is not available in JDK9+
*/
assumeFalse(sslServerProvider() == SslProvider.JDK && PlatformDependent.javaVersion() > 8);
String originalSystemPropertyValue = SystemPropertyUtil.get(SslMasterKeyHandler.SYSTEM_PROP_KEY);
System.setProperty(SslMasterKeyHandler.SYSTEM_PROP_KEY, Boolean.TRUE.toString());
SelfSignedCertificate ssc = CachedSelfSignedCertificate.getCachedCertificate();
serverSslCtx = wrapContext(param, SslContextBuilder.forServer(ssc.certificate(), ssc.privateKey())
.sslProvider(sslServerProvider())
.sslContextProvider(serverSslContextProvider())
.protocols(param.protocols())
.ciphers(param.ciphers())
.build());
try {
sb = new ServerBootstrap();
sb.group(new MultiThreadIoEventLoopGroup(NioIoHandler.newFactory()));
sb.channel(NioServerSocketChannel.class);
final Promise<SecretKey> promise = sb.config().group().next().newPromise();
serverChannel = sb.childHandler(new ChannelInitializer<Channel>() {
@Override
protected void initChannel(Channel ch) {
ch.config().setAllocator(new TestByteBufAllocator(ch.config().getAllocator(), param.type()));
SslHandler sslHandler = !param.delegate() ?
serverSslCtx.newHandler(ch.alloc()) :
serverSslCtx.newHandler(ch.alloc(), delegatingExecutor);
ch.pipeline().addLast(sslHandler);
ch.pipeline().addLast(new SslMasterKeyHandler() {
@Override
protected void accept(SecretKey masterKey, SSLSession session) {
promise.setSuccess(masterKey);
}
});
serverConnectedChannel = ch;
}
}).bind(new InetSocketAddress(0)).sync().channel();
int port = ((InetSocketAddress) serverChannel.localAddress()).getPort();
SSLContext sslContext = SSLContext.getInstance("TLS");
sslContext.init(null, InsecureTrustManagerFactory.INSTANCE.getTrustManagers(), null);
try (Socket socket = sslContext.getSocketFactory().createSocket(NetUtil.LOCALHOST, port)) {
OutputStream out = socket.getOutputStream();
out.write(1);
out.flush();
assertTrue(promise.await(10, TimeUnit.SECONDS));
SecretKey key = promise.get();
assertEquals(48, key.getEncoded().length, "AES secret key must be 48 bytes");
}
} finally {
if (originalSystemPropertyValue != null) {
System.setProperty(SslMasterKeyHandler.SYSTEM_PROP_KEY, originalSystemPropertyValue);
} else {
System.clearProperty(SslMasterKeyHandler.SYSTEM_PROP_KEY);
}
}
}
Domain
Subdomains
Source
Frequently Asked Questions
What does testMasterKeyLogging() do?
testMasterKeyLogging() is a function in the netty codebase, defined in handler/src/test/java/io/netty/handler/ssl/SSLEngineTest.java.
Where is testMasterKeyLogging() defined?
testMasterKeyLogging() is defined in handler/src/test/java/io/netty/handler/ssl/SSLEngineTest.java at line 4520.
What does testMasterKeyLogging() call?
testMasterKeyLogging() calls 4 function(s): TestByteBufAllocator, ciphers, delegate, protocols.
Analyze Your Own Codebase
Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.
Try Supermodel Free