Top Description Inners Fields Constructors Methods
org.apache.tomcat.util.net

public Class TLSClientHelloExtractor

extends Object
Class Inheritance
Imports
java.io.IOException, java.nio.BufferUnderflowException, .ByteBuffer, java.nio.charset.StandardCharsets, java.util.ArrayList, .List, .Locale, org.apache.juli.logging.Log, .LogFactory, org.apache.tomcat.util.buf.HexUtils, org.apache.tomcat.util.http.parser.HttpParser, org.apache.tomcat.util.net.openssl.ciphers.Cipher, org.apache.tomcat.util.res.StringManager

This class extracts the SNI host name and ALPN protocols from a TLS client-hello message.

Nested and Inner Type Summary

Modifier and TypeClass and Description
public static enum

Field Summary

Modifier and TypeField and Description
private final List<String>
private final List<String>
private final List<Cipher>
private final List<String>
private static final Log
private final TLSClientHelloExtractor.ExtractorResult
private static final StringManager
private final String
private static final int
private static final int
private static final int
private static final int
public static byte[]

Constructor Summary

AccessConstructor and Description
public
TLSClientHelloExtractor(ByteBuffer
The buffer containing the TLS data to process
netInBuffer
)

Creates the instance of the parser and processes the provided buffer.

Method Summary

Modifier and TypeMethod and Description
public List<String>
public List<String>
public List<Cipher>
public List<String>
public TLSClientHelloExtractor.ExtractorResult
public String

Returns:

The SNI value provided by the client converted to lower case if not already lower case.
getSNIValue
()

private static TLSClientHelloExtractor.ExtractorResult
private static boolean
private static boolean
private static boolean
isAvailable(ByteBuffer bb, int size)

private static boolean
private static boolean
private static boolean
private static void
private static String
private static String
private static void
private static void
skipBytes(ByteBuffer bb, int size)

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

clientRequestedApplicationProtocolsback to summary
private final List<String> clientRequestedApplicationProtocols
clientRequestedCipherNamesback to summary
private final List<String> clientRequestedCipherNames
clientRequestedCiphersback to summary
private final List<Cipher> clientRequestedCiphers
clientRequestedProtocolsback to summary
private final List<String> clientRequestedProtocols
logback to summary
private static final Log log
resultback to summary
private final TLSClientHelloExtractor.ExtractorResult result
smback to summary
private static final StringManager sm
sniValueback to summary
private final String sniValue
TLS_EXTENSION_ALPNback to summary
private static final int TLS_EXTENSION_ALPN
TLS_EXTENSION_SERVER_NAMEback to summary
private static final int TLS_EXTENSION_SERVER_NAME
TLS_EXTENSION_SUPPORTED_VERSIONback to summary
private static final int TLS_EXTENSION_SUPPORTED_VERSION
TLS_RECORD_HEADER_LENback to summary
private static final int TLS_RECORD_HEADER_LEN
USE_TLS_RESPONSEback to summary
public static byte[] USE_TLS_RESPONSE

Constructor Detail

TLSClientHelloExtractorback to summary
public TLSClientHelloExtractor(ByteBuffer netInBuffer) throws IOException

Creates the instance of the parser and processes the provided buffer. The buffer position and limit will be modified during the execution of this method but they will be returned to the original values before the method exits.

Parameters
netInBuffer:ByteBuffer

The buffer containing the TLS data to process

Exceptions
IOException:
If the client hello message is malformed

Method Detail

getClientRequestedApplicationProtocolsback to summary
public List<String> getClientRequestedApplicationProtocols()
getClientRequestedCipherNamesback to summary
public List<String> getClientRequestedCipherNames()
getClientRequestedCiphersback to summary
public List<Cipher> getClientRequestedCiphers()
getClientRequestedProtocolsback to summary
public List<String> getClientRequestedProtocols()
getResultback to summary
public TLSClientHelloExtractor.ExtractorResult getResult()
getSNIValueback to summary
public String getSNIValue()
Returns:String

The SNI value provided by the client converted to lower case if not already lower case.

handleIncompleteReadback to summary
private static TLSClientHelloExtractor.ExtractorResult handleIncompleteRead(ByteBuffer bb)
isAllClientHelloAvailableback to summary
private static boolean isAllClientHelloAvailable(ByteBuffer bb)
isAllRecordAvailableback to summary
private static boolean isAllRecordAvailable(ByteBuffer bb)
isAvailableback to summary
private static boolean isAvailable(ByteBuffer bb, int size)
isClientHelloback to summary
private static boolean isClientHello(ByteBuffer bb)
isHttpback to summary
private static boolean isHttp(ByteBuffer bb)
isTLSHandshakeback to summary
private static boolean isTLSHandshake(ByteBuffer bb)
readAlpnExtensionback to summary
private static void readAlpnExtension(ByteBuffer bb, List<String> protocolNames)
readProtocolback to summary
private static String readProtocol(ByteBuffer bb)
readSniExtensionback to summary
private static String readSniExtension(ByteBuffer bb)
readSupportedVersionsback to summary
private static void readSupportedVersions(ByteBuffer bb, List<String> protocolNames)
skipBytesback to summary
private static void skipBytes(ByteBuffer bb, int size)
org.apache.tomcat.util.net back to summary

public final Enum TLSClientHelloExtractor.ExtractorResult

extends Enum<TLSClientHelloExtractor.ExtractorResult>
Class Inheritance

Field Summary

Modifier and TypeField and Description
public static final TLSClientHelloExtractor.ExtractorResult
public static final TLSClientHelloExtractor.ExtractorResult
public static final TLSClientHelloExtractor.ExtractorResult
public static final TLSClientHelloExtractor.ExtractorResult
public static final TLSClientHelloExtractor.ExtractorResult

Constructor Summary

AccessConstructor and Description
private

Method Summary

Modifier and TypeMethod and Description
public static TLSClientHelloExtractor.ExtractorResult
public static TLSClientHelloExtractor.ExtractorResult[]
Inherited from java.lang.Enum:
clonecompareTodescribeConstableequalsfinalizegetDeclaringClasshashCodenameordinaltoStringvalueOf

Field Detail

COMPLETEback to summary
public static final TLSClientHelloExtractor.ExtractorResult COMPLETE
NEED_READback to summary
public static final TLSClientHelloExtractor.ExtractorResult NEED_READ
NON_SECUREback to summary
public static final TLSClientHelloExtractor.ExtractorResult NON_SECURE
NOT_PRESENTback to summary
public static final TLSClientHelloExtractor.ExtractorResult NOT_PRESENT
UNDERFLOWback to summary
public static final TLSClientHelloExtractor.ExtractorResult UNDERFLOW

Constructor Detail

ExtractorResultback to summary
private ExtractorResult()

Method Detail

valueOfback to summary
public static TLSClientHelloExtractor.ExtractorResult valueOf(String name)
valuesback to summary
public static TLSClientHelloExtractor.ExtractorResult[] values()