Home / Class/ BoringSSLSessionTicketCallback Class — netty Architecture

BoringSSLSessionTicketCallback Class — netty Architecture

Architecture documentation for the BoringSSLSessionTicketCallback class in BoringSSLSessionTicketCallback.java from the netty codebase.

Entity Profile

Dependency Diagram

graph TD
  9a30c978_1e7f_a3dd_318a_2f49a0e77687["BoringSSLSessionTicketCallback"]
  63de5782_e8fa_617d_658f_2db6ec8577a2["BoringSSLSessionTicketCallback.java"]
  9a30c978_1e7f_a3dd_318a_2f49a0e77687 -->|defined in| 63de5782_e8fa_617d_658f_2db6ec8577a2
  3d2230db_fed0_ff42_3737_c55ebe3efcf1["findSessionTicket()"]
  9a30c978_1e7f_a3dd_318a_2f49a0e77687 -->|method| 3d2230db_fed0_ff42_3737_c55ebe3efcf1
  6f3cee28_42a9_99b3_1be1_5c0ed1e25151["setSessionTicketKeys()"]
  9a30c978_1e7f_a3dd_318a_2f49a0e77687 -->|method| 6f3cee28_42a9_99b3_1be1_5c0ed1e25151

Relationship Graph

Source Code

codec-classes-quic/src/main/java/io/netty/handler/codec/quic/BoringSSLSessionTicketCallback.java lines 21–66

final class BoringSSLSessionTicketCallback {

    // As we dont assume to have a lot of keys configured we will just use an array for now as a data store.
    private volatile byte[][] sessionKeys;

    // Accessed via JNI.
    byte @Nullable [] findSessionTicket(byte @Nullable [] keyname) {
        byte[][] keys = this.sessionKeys;
        if (keys == null || keys.length == 0) {
            return null;
        }
        if (keyname == null) {
            return keys[0];
        }

        for (int i = 0; i < keys.length; i++) {
            byte[] key = keys[i];
            if (PlatformDependent.equals(keyname, 0, key, 1, keyname.length)) {
                return key;
            }
        }
        return null;
    }

    void setSessionTicketKeys(SslSessionTicketKey @Nullable [] keys) {
        if (keys != null && keys.length != 0) {
            byte[][] sessionKeys = new byte[keys.length][];
            for (int i = 0; i < keys.length; ++i) {
                SslSessionTicketKey key = keys[i];
                byte[] binaryKey = new byte[49];
                // We mark the first key as preferred by using 1 as byte marker
                binaryKey[0] = i == 0 ? (byte) 1 : (byte) 0;
                int dstCurPos = 1;
                System.arraycopy(key.name, 0, binaryKey, dstCurPos, 16);
                dstCurPos += 16;
                System.arraycopy(key.hmacKey, 0, binaryKey, dstCurPos, 16);
                dstCurPos += 16;
                System.arraycopy(key.aesKey, 0, binaryKey, dstCurPos, 16);
                sessionKeys[i] = binaryKey;
            }
            this.sessionKeys = sessionKeys;
        } else {
            sessionKeys = null;
        }
    }
}

Frequently Asked Questions

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

Analyze Your Own Codebase

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

Try Supermodel Free