Home / Class/ QuicheQuicSslSession Class — netty Architecture

QuicheQuicSslSession Class — netty Architecture

Architecture documentation for the QuicheQuicSslSession class in QuicheQuicSslEngine.java from the netty codebase.

Entity Profile

Dependency Diagram

graph TD
  453b39a5_2559_f486_48cb_8821ee8fee5a["QuicheQuicSslSession"]
  f643bd0e_3633_f692_fa7e_09b3d32c33f5["QuicheQuicSslEngine.java"]
  453b39a5_2559_f486_48cb_8821ee8fee5a -->|defined in| f643bd0e_3633_f692_fa7e_09b3d32c33f5
  baaecb55_9a6a_00eb_53de_8db4f152a595["isEmpty()"]
  453b39a5_2559_f486_48cb_8821ee8fee5a -->|method| baaecb55_9a6a_00eb_53de_8db4f152a595
  2f0da474_3134_b68a_b8a2_24f626147d14["handshakeFinished()"]
  453b39a5_2559_f486_48cb_8821ee8fee5a -->|method| 2f0da474_3134_b68a_b8a2_24f626147d14
  a65046e4_e3ba_0111_4757_dfbfea1a7aab["removeFromCacheIfInvalid()"]
  453b39a5_2559_f486_48cb_8821ee8fee5a -->|method| a65046e4_e3ba_0111_4757_dfbfea1a7aab
  c82dda45_c3cb_c9e1_d76d_355a4887b5d5["removeFromCache()"]
  453b39a5_2559_f486_48cb_8821ee8fee5a -->|method| c82dda45_c3cb_c9e1_d76d_355a4887b5d5
  4ea49efe_8dcd_77b8_5a95_84d971494166["initPeerCerts()"]
  453b39a5_2559_f486_48cb_8821ee8fee5a -->|method| 4ea49efe_8dcd_77b8_5a95_84d971494166
  8b9ba183_a3b1_2ccd_f4f0_6121f3f81994["initCerts()"]
  453b39a5_2559_f486_48cb_8821ee8fee5a -->|method| 8b9ba183_a3b1_2ccd_f4f0_6121f3f81994
  b567104a_eccd_458e_92d1_5ef18b44cddb["getId()"]
  453b39a5_2559_f486_48cb_8821ee8fee5a -->|method| b567104a_eccd_458e_92d1_5ef18b44cddb
  47d51e85_190a_81bd_52a5_662a19e96711["SSLSessionContext()"]
  453b39a5_2559_f486_48cb_8821ee8fee5a -->|method| 47d51e85_190a_81bd_52a5_662a19e96711
  100a93ee_c2fd_5b91_16ea_526a7e6e2363["getCreationTime()"]
  453b39a5_2559_f486_48cb_8821ee8fee5a -->|method| 100a93ee_c2fd_5b91_16ea_526a7e6e2363
  43021d0a_710d_9b30_653e_8107943a7dd6["getLastAccessedTime()"]
  453b39a5_2559_f486_48cb_8821ee8fee5a -->|method| 43021d0a_710d_9b30_653e_8107943a7dd6
  095369d3_986d_6095_88d1_72e807c4e240["invalidate()"]
  453b39a5_2559_f486_48cb_8821ee8fee5a -->|method| 095369d3_986d_6095_88d1_72e807c4e240
  0c855d51_96dc_9bff_0f26_7cb2b8212aa1["isValid()"]
  453b39a5_2559_f486_48cb_8821ee8fee5a -->|method| 0c855d51_96dc_9bff_0f26_7cb2b8212aa1
  8eb107f7_a8c4_500c_f140_54548981c456["putValue()"]
  453b39a5_2559_f486_48cb_8821ee8fee5a -->|method| 8eb107f7_a8c4_500c_f140_54548981c456

Relationship Graph

Source Code

codec-classes-quic/src/main/java/io/netty/handler/codec/quic/QuicheQuicSslEngine.java lines 285–593

    private final class QuicheQuicSslSession implements SSLSession {
        private X509Certificate[] x509PeerCerts;
        private Certificate[] peerCerts;
        private String protocol;
        private String cipher;
        private byte[] id;
        private long creationTime = -1;
        private long timeout = -1;
        private boolean invalid;
        private long lastAccessedTime = -1;

        // lazy init for memory reasons
        private Map<String, Object> values;

        private boolean isEmpty(Object @Nullable [] arr) {
            return arr == null || arr.length == 0;
        }
        private boolean isEmpty(byte @Nullable [] arr) {
            return arr == null || arr.length == 0;
        }

        void handshakeFinished(byte[] id, String cipher, String protocol, byte[] peerCertificate,
                               byte[][] peerCertificateChain, long creationTime, long timeout) {
            synchronized (QuicheQuicSslEngine.this) {
                initPeerCerts(peerCertificateChain, peerCertificate);
                this.id = id;
                this.cipher = cipher;
                this.protocol = protocol;
                this.creationTime = creationTime * 1000L;
                this.timeout = timeout * 1000L;
                lastAccessedTime = System.currentTimeMillis();
            }
        }

        void removeFromCacheIfInvalid() {
            if (!isValid()) {
                // Shouldn't be re-used again
                removeFromCache();
            }
        }

        private void removeFromCache() {
            // Shouldn't be re-used again
            QuicClientSessionCache cache = ctx.getSessionCache();
            if (cache != null) {
                cache.removeSession(getPeerHost(), getPeerPort());
            }
        }

        /**
         * Init peer certificates that can be obtained via {@link #getPeerCertificateChain()}
         * and {@link #getPeerCertificates()}.
         */
        private void initPeerCerts(byte[][] chain, byte[] clientCert) {
            // Return the full chain from the JNI layer.
            if (getUseClientMode()) {
                if (isEmpty(chain)) {
                    peerCerts = EmptyArrays.EMPTY_CERTIFICATES;
                    x509PeerCerts = EmptyArrays.EMPTY_JAVAX_X509_CERTIFICATES;
                } else {
                    peerCerts = new Certificate[chain.length];
                    x509PeerCerts = new X509Certificate[chain.length];
                    initCerts(chain, 0);
                }
            } else {
                // if used on the server side SSL_get_peer_cert_chain(...) will not include the remote peer
                // certificate. We use SSL_get_peer_certificate to get it in this case and add it to our
                // array later.
                //
                // See https://www.openssl.org/docs/ssl/SSL_get_peer_cert_chain.html
                if (isEmpty(clientCert)) {
                    peerCerts = EmptyArrays.EMPTY_CERTIFICATES;
                    x509PeerCerts = EmptyArrays.EMPTY_JAVAX_X509_CERTIFICATES;
                } else {
                    if (isEmpty(chain)) {
                        peerCerts = new Certificate[] {new LazyX509Certificate(clientCert)};
                        x509PeerCerts = new X509Certificate[] {new LazyJavaxX509Certificate(clientCert)};
                    } else {
                        peerCerts = new Certificate[chain.length + 1];
                        x509PeerCerts = new X509Certificate[chain.length + 1];
                        peerCerts[0] = new LazyX509Certificate(clientCert);

Frequently Asked Questions

What is the QuicheQuicSslSession class?
QuicheQuicSslSession is a class in the netty codebase, defined in codec-classes-quic/src/main/java/io/netty/handler/codec/quic/QuicheQuicSslEngine.java.
Where is QuicheQuicSslSession defined?
QuicheQuicSslSession is defined in codec-classes-quic/src/main/java/io/netty/handler/codec/quic/QuicheQuicSslEngine.java at line 285.

Analyze Your Own Codebase

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

Try Supermodel Free