Home / Function/ resumptionWithLargeCertificates() — netty Function Reference

resumptionWithLargeCertificates() — netty Function Reference

Architecture documentation for the resumptionWithLargeCertificates() function in SocketSslLargeCertificateTest.java from the netty codebase.

Entity Profile

Dependency Diagram

graph TD
  1cd25f7a_2a5a_cae4_0b9f_9d9f608514c8["resumptionWithLargeCertificates()"]
  f7c3b053_8072_7730_8f03_078336ec47ba["SocketSslLargeCertificateTest"]
  1cd25f7a_2a5a_cae4_0b9f_9d9f608514c8 -->|defined in| f7c3b053_8072_7730_8f03_078336ec47ba
  style 1cd25f7a_2a5a_cae4_0b9f_9d9f608514c8 fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

testsuite/src/main/java/io/netty/testsuite/transport/socket/SocketSslLargeCertificateTest.java lines 104–229

    @ParameterizedTest
    @MethodSource("certExtensionSizes")
    void resumptionWithLargeCertificates(int certExtensionSize) throws Exception {
        X509Bundle serverCert = base.copy()
                .subject("cn=localhost")
                .addExtendedKeyUsageServerAuth()
                .buildIssuedBy(rootCert);
        byte[] extension = new byte[certExtensionSize];
        ThreadLocalRandom.current().nextBytes(extension);
        X509Bundle clientCert = base.copy()
                .subject("cn=client")
                .addExtendedKeyUsageClientAuth()
                .addExtensionOctetString("1.2.840.113635.100.6.2.1", false, extension)
                .buildIssuedBy(rootCert);

        TrustManagerFactory tmf = rootCert.toTrustManagerFactory();
        KeyManagerFactory serverKmf = serverCert.toKeyManagerFactory();
        KeyManagerFactory clientKmf = clientCert.toKeyManagerFactory();

        SslContext serverSsl = SslContextBuilder.forServer(serverKmf)
                .sslProvider(SslProvider.OPENSSL)
                .trustManager(tmf)
                .protocols("TLSv1.3")
                .clientAuth(ClientAuth.REQUIRE)
                .option(OpenSslContextOption.MAX_CERTIFICATE_LIST_BYTES, 32768)
                .build();
        SslContext clientSsl = SslContextBuilder.forClient()
                .sslProvider(SslProvider.OPENSSL)
                .keyManager(clientKmf)
                .trustManager(tmf)
                .protocols("TLSv1.3")
                .option(OpenSslContextOption.MAX_CERTIFICATE_LIST_BYTES, 32768)
                .serverName(new SNIHostName("localhost"))
                .endpointIdentificationAlgorithm(null)
                .build();

        final Promise<Void> completion = ImmediateEventExecutor.INSTANCE.newPromise();

        ChannelFuture bindFuture = new ServerBootstrap()
                .group(group)
                .channel(NioServerSocketChannel.class)
                .childHandler(new ChannelInitializer<Channel>() {
                    @Override
                    protected void initChannel(Channel ch) throws Exception {
                        ch.pipeline().addLast(serverSsl.newHandler(ch.alloc()));
                        ch.pipeline().addLast(new ChannelInboundHandlerAdapter() {
                            @Override
                            public void userEventTriggered(ChannelHandlerContext ctx, Object evt) throws Exception {
                                if (evt instanceof SslHandshakeCompletionEvent) {
                                    SslHandshakeCompletionEvent completionEvent = (SslHandshakeCompletionEvent) evt;
                                    if (completionEvent.isSuccess()) {
                                        ctx.writeAndFlush(Unpooled.buffer());
                                    } else {
                                        completion.tryFailure(new ExecutionException(completionEvent.cause()));
                                        ctx.close();
                                    }
                                }
                            }

                            @Override
                            public void channelRead(ChannelHandlerContext ctx, Object msg) throws Exception {
                                ctx.write(msg);
                            }

                            @Override
                            public void channelReadComplete(ChannelHandlerContext ctx) throws Exception {
                                ctx.flush();
                            }
                        });
                    }
                })
                .bind(InetAddress.getLoopbackAddress(), 0);
        Channel serverChannel = bindFuture.sync().channel();
        InetSocketAddress serverAddress = (InetSocketAddress) serverChannel.localAddress();
        ChannelFuture connectFuture = new Bootstrap()
                .group(group)
                .channel(NioSocketChannel.class)
                .handler(new ChannelInitializer<Channel>() {
                    @Override
                    protected void initChannel(Channel ch) throws Exception {
                        ch.pipeline().addLast(clientSsl.newHandler(ch.alloc(), "localhost", serverAddress.getPort()));

Domain

Subdomains

Frequently Asked Questions

What does resumptionWithLargeCertificates() do?
resumptionWithLargeCertificates() is a function in the netty codebase, defined in testsuite/src/main/java/io/netty/testsuite/transport/socket/SocketSslLargeCertificateTest.java.
Where is resumptionWithLargeCertificates() defined?
resumptionWithLargeCertificates() is defined in testsuite/src/main/java/io/netty/testsuite/transport/socket/SocketSslLargeCertificateTest.java at line 104.

Analyze Your Own Codebase

Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.

Try Supermodel Free