OpenSslPrivateKeyMethodTest Class — netty Architecture
Architecture documentation for the OpenSslPrivateKeyMethodTest class in OpenSslPrivateKeyMethodTest.java from the netty codebase.
Entity Profile
Dependency Diagram
graph TD e0537394_11f7_7d84_df6a_7390455b871b["OpenSslPrivateKeyMethodTest"] 81a6c13b_b22c_6ee8_08c1_85d9e192525a["OpenSslPrivateKeyMethodTest.java"] e0537394_11f7_7d84_df6a_7390455b871b -->|defined in| 81a6c13b_b22c_6ee8_08c1_85d9e192525a b0eeb9f8_df8e_fa43_59b6_9adf63186e6a["parameters()"] e0537394_11f7_7d84_df6a_7390455b871b -->|method| b0eeb9f8_df8e_fa43_59b6_9adf63186e6a 10e92c16_4654_b4b4_d1d4_55c3fe8ee82c["init()"] e0537394_11f7_7d84_df6a_7390455b871b -->|method| 10e92c16_4654_b4b4_d1d4_55c3fe8ee82c a47859bf_748e_b153_ada4_2a2b83e0879f["destroy()"] e0537394_11f7_7d84_df6a_7390455b871b -->|method| a47859bf_748e_b153_ada4_2a2b83e0879f 63310003_98c5_4569_fb36_d807a91e6f72["assumeCipherAvailable()"] e0537394_11f7_7d84_df6a_7390455b871b -->|method| 63310003_98c5_4569_fb36_d807a91e6f72 65a59469_d71f_7606_04cb_d2d8bdd690a8["SslHandler()"] e0537394_11f7_7d84_df6a_7390455b871b -->|method| 65a59469_d71f_7606_04cb_d2d8bdd690a8 502369ca_b225_9482_81d0_c679e756e1e9["SslContext()"] e0537394_11f7_7d84_df6a_7390455b871b -->|method| 502369ca_b225_9482_81d0_c679e756e1e9 8edbe9c4_ff24_33fe_2826_3d5d8ec5f158["Executor()"] e0537394_11f7_7d84_df6a_7390455b871b -->|method| 8edbe9c4_ff24_33fe_2826_3d5d8ec5f158 1dd89d03_8a52_ce64_f8f1_14c4530dada0["assertThread()"] e0537394_11f7_7d84_df6a_7390455b871b -->|method| 1dd89d03_8a52_ce64_f8f1_14c4530dada0 90ad078f_18cd_88ab_2be6_3ed8d8a318ea["testPrivateKeyMethod()"] e0537394_11f7_7d84_df6a_7390455b871b -->|method| 90ad078f_18cd_88ab_2be6_3ed8d8a318ea d2dcb905_2bba_58af_197e_780aa47b24bb["testPrivateKeyMethodFailsBecauseOfException()"] e0537394_11f7_7d84_df6a_7390455b871b -->|method| d2dcb905_2bba_58af_197e_780aa47b24bb b93182f7_a6b7_e2b3_fcbd_335ce31834cf["testPrivateKeyMethodFailsBecauseOfNull()"] e0537394_11f7_7d84_df6a_7390455b871b -->|method| b93182f7_a6b7_e2b3_fcbd_335ce31834cf b15a5bb7_43a2_d1ed_9d3b_43d37b8d6f4b["testPrivateKeyMethodFails()"] e0537394_11f7_7d84_df6a_7390455b871b -->|method| b15a5bb7_43a2_d1ed_9d3b_43d37b8d6f4b de338b10_e350_a6ed_b148_78a17f84a70b["Channel()"] e0537394_11f7_7d84_df6a_7390455b871b -->|method| de338b10_e350_a6ed_b148_78a17f84a70b
Relationship Graph
Source Code
handler/src/test/java/io/netty/handler/ssl/OpenSslPrivateKeyMethodTest.java lines 74–483
public class OpenSslPrivateKeyMethodTest {
private static final String RFC_CIPHER_NAME = "TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256";
private static EventLoopGroup GROUP;
private static X509Bundle CERT;
private static DelayingExecutor EXECUTOR;
static Collection<Object[]> parameters() {
List<Object[]> dst = new ArrayList<Object[]>();
for (int a = 0; a < 2; a++) {
for (int b = 0; b < 2; b++) {
for (int c = 0; c < 2; c++) {
dst.add(new Object[] { a == 0, b == 0, c == 0 });
}
}
}
return dst;
}
@BeforeAll
public static void init() throws Exception {
checkShouldUseKeyManagerFactory();
assumeTrue(OpenSsl.isBoringSSL() || OpenSsl.isAWSLC());
// Check if the cipher is supported at all which may not be the case for various JDK versions and OpenSSL API
// implementations.
assumeCipherAvailable(SslProvider.OPENSSL);
assumeCipherAvailable(SslProvider.JDK);
GROUP = new MultiThreadIoEventLoopGroup(LocalIoHandler.newFactory());
CERT = new CertificateBuilder()
.rsa2048()
.subject("cn=localhost")
.setIsCertificateAuthority(true)
.buildSelfSigned();
EXECUTOR = new DelayingExecutor(new ThreadFactory() {
@Override
public Thread newThread(Runnable r) {
return new DelegateThread(r);
}
});
}
@AfterAll
public static void destroy() throws InterruptedException {
if (OpenSsl.isBoringSSL() || OpenSsl.isAWSLC()) {
GROUP.shutdownGracefully().sync();
assertTrue(EXECUTOR.shutdownAndAwaitTermination(5, TimeUnit.SECONDS));
}
}
private static void assumeCipherAvailable(SslProvider provider) throws NoSuchAlgorithmException {
boolean cipherSupported = false;
if (provider == SslProvider.JDK) {
SSLEngine engine = SSLContext.getDefault().createSSLEngine();
for (String c: engine.getSupportedCipherSuites()) {
if (RFC_CIPHER_NAME.equals(c)) {
cipherSupported = true;
break;
}
}
} else {
cipherSupported = OpenSsl.isCipherSuiteAvailable(RFC_CIPHER_NAME);
}
assumeTrue(cipherSupported, "Unsupported cipher: " + RFC_CIPHER_NAME);
}
private static SslHandler newSslHandler(SslContext sslCtx, ByteBufAllocator allocator, Executor executor) {
if (executor == null) {
return sslCtx.newHandler(allocator);
} else {
return sslCtx.newHandler(allocator, executor);
}
}
private SslContext buildServerContext(OpenSslPrivateKeyMethod method) throws Exception {
List<String> ciphers = Collections.singletonList(RFC_CIPHER_NAME);
final KeyManagerFactory kmf = OpenSslX509KeyManagerFactory.newKeyless(CERT.getCertificatePath());
return SslContextBuilder.forServer(kmf)
.sslProvider(SslProvider.OPENSSL)
Source
Frequently Asked Questions
What is the OpenSslPrivateKeyMethodTest class?
OpenSslPrivateKeyMethodTest is a class in the netty codebase, defined in handler/src/test/java/io/netty/handler/ssl/OpenSslPrivateKeyMethodTest.java.
Where is OpenSslPrivateKeyMethodTest defined?
OpenSslPrivateKeyMethodTest is defined in handler/src/test/java/io/netty/handler/ssl/OpenSslPrivateKeyMethodTest.java at line 74.
Analyze Your Own Codebase
Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.
Try Supermodel Free