Home / Function/ handshakeFinished() — netty Function Reference

handshakeFinished() — netty Function Reference

Architecture documentation for the handshakeFinished() function in ReferenceCountedOpenSslEngine.java from the netty codebase.

Function java Buffer Allocators calls 6 called by 1

Entity Profile

Dependency Diagram

graph TD
  6a172ec1_1af9_cb55_7e05_2b066e89e30e["handshakeFinished()"]
  70581b12_79ee_1937_703d_e9d4631c418e["DefaultOpenSslSession"]
  6a172ec1_1af9_cb55_7e05_2b066e89e30e -->|defined in| 70581b12_79ee_1937_703d_e9d4631c418e
  70ac8c99_3ca9_c202_a13f_16dda4571164["handshake()"]
  70ac8c99_3ca9_c202_a13f_16dda4571164 -->|calls| 6a172ec1_1af9_cb55_7e05_2b066e89e30e
  23ebb116_ac2d_3518_355f_85beec7211e7["OpenSslSessionId()"]
  6a172ec1_1af9_cb55_7e05_2b066e89e30e -->|calls| 23ebb116_ac2d_3518_355f_85beec7211e7
  6ea33493_29cb_2a78_e5c3_fba44fe98971["setSessionDetails()"]
  6a172ec1_1af9_cb55_7e05_2b066e89e30e -->|calls| 6ea33493_29cb_2a78_e5c3_fba44fe98971
  c2be282d_110e_3809_ba91_f76a8d2a4b03["isEmpty()"]
  6a172ec1_1af9_cb55_7e05_2b066e89e30e -->|calls| c2be282d_110e_3809_ba91_f76a8d2a4b03
  7354512f_0d7a_f787_7480_a61251713f00["initCerts()"]
  6a172ec1_1af9_cb55_7e05_2b066e89e30e -->|calls| 7354512f_0d7a_f787_7480_a61251713f00
  d0f145d8_8f24_09af_02a9_d6a3f99d7a51["calculateMaxWrapOverhead()"]
  6a172ec1_1af9_cb55_7e05_2b066e89e30e -->|calls| d0f145d8_8f24_09af_02a9_d6a3f99d7a51
  91fc1e9f_da8a_5369_c205_f01b69e8bd01["SSLException()"]
  6a172ec1_1af9_cb55_7e05_2b066e89e30e -->|calls| 91fc1e9f_da8a_5369_c205_f01b69e8bd01
  style 6a172ec1_1af9_cb55_7e05_2b066e89e30e fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

handler/src/main/java/io/netty/handler/ssl/ReferenceCountedOpenSslEngine.java lines 2538–2614

        @Override
        public void handshakeFinished(byte[] id, String cipher, String protocol, byte[] peerCertificate,
                                      byte[][] peerCertificateChain, long creationTime, long timeout)
                throws SSLException {
            synchronized (ReferenceCountedOpenSslEngine.this) {
                if (!destroyed) {
                    if (this.id == OpenSslSessionId.NULL_ID) {
                        // if the handshake finished and it was not a resumption let ensure we try to set the id

                        this.id = id == null ? OpenSslSessionId.NULL_ID : new OpenSslSessionId(id);
                        // Once the handshake was done the lastAccessed and creationTime should be the same if we
                        // did not set it earlier via setSessionDetails(...)
                        this.creationTime = lastAccessed = creationTime;
                    }
                    this.cipher = toJavaCipherSuite(cipher);
                    this.protocol = protocol;

                    if (clientMode) {
                        if (isEmpty(peerCertificateChain)) {
                            peerCerts = EmptyArrays.EMPTY_CERTIFICATES;
                            if (OpenSsl.JAVAX_CERTIFICATE_CREATION_SUPPORTED) {
                                x509PeerCerts = EmptyArrays.EMPTY_JAVAX_X509_CERTIFICATES;
                            } else {
                                x509PeerCerts = JAVAX_CERTS_NOT_SUPPORTED;
                            }
                        } else {
                            peerCerts = new Certificate[peerCertificateChain.length];
                            if (OpenSsl.JAVAX_CERTIFICATE_CREATION_SUPPORTED) {
                                x509PeerCerts = new X509Certificate[peerCertificateChain.length];
                            } else {
                                x509PeerCerts = JAVAX_CERTS_NOT_SUPPORTED;
                            }
                            initCerts(peerCertificateChain, 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(peerCertificate)) {
                            peerCerts = EmptyArrays.EMPTY_CERTIFICATES;
                            x509PeerCerts = EmptyArrays.EMPTY_JAVAX_X509_CERTIFICATES;
                        } else {
                            if (isEmpty(peerCertificateChain)) {
                                peerCerts = new Certificate[] {new LazyX509Certificate(peerCertificate)};
                                if (OpenSsl.JAVAX_CERTIFICATE_CREATION_SUPPORTED) {
                                    x509PeerCerts = new X509Certificate[] {
                                            new LazyJavaxX509Certificate(peerCertificate)
                                    };
                                } else {
                                    x509PeerCerts = JAVAX_CERTS_NOT_SUPPORTED;
                                }
                            } else {
                                peerCerts = new Certificate[peerCertificateChain.length + 1];
                                peerCerts[0] = new LazyX509Certificate(peerCertificate);

                                if (OpenSsl.JAVAX_CERTIFICATE_CREATION_SUPPORTED) {
                                    x509PeerCerts = new X509Certificate[peerCertificateChain.length + 1];
                                    x509PeerCerts[0] = new LazyJavaxX509Certificate(peerCertificate);
                                } else {
                                    x509PeerCerts = JAVAX_CERTS_NOT_SUPPORTED;
                                }

                                initCerts(peerCertificateChain, 1);
                            }
                        }
                    }

                    calculateMaxWrapOverhead();

                    handshakeState = HandshakeState.FINISHED;
                } else {
                    throw new SSLException("Already closed");
                }
            }
        }

Domain

Subdomains

Called By

Frequently Asked Questions

What does handshakeFinished() do?
handshakeFinished() is a function in the netty codebase, defined in handler/src/main/java/io/netty/handler/ssl/ReferenceCountedOpenSslEngine.java.
Where is handshakeFinished() defined?
handshakeFinished() is defined in handler/src/main/java/io/netty/handler/ssl/ReferenceCountedOpenSslEngine.java at line 2538.
What does handshakeFinished() call?
handshakeFinished() calls 6 function(s): OpenSslSessionId, SSLException, calculateMaxWrapOverhead, initCerts, isEmpty, setSessionDetails.
What calls handshakeFinished()?
handshakeFinished() is called by 1 function(s): handshake.

Analyze Your Own Codebase

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

Try Supermodel Free