Share via


IHttpSysRequestPropertyFeature.TryGetTlsClientHello Method

Definition

Reads the TLS client hello from HTTP.SYS

public bool TryGetTlsClientHello(Span<byte> tlsClientHelloBytesDestination, out int bytesReturned);
abstract member TryGetTlsClientHello : Span<byte> * int -> bool
Public Function TryGetTlsClientHello (tlsClientHelloBytesDestination As Span(Of Byte), ByRef bytesReturned As Integer) As Boolean

Parameters

tlsClientHelloBytesDestination
Span<Byte>

Where the raw bytes of the TLS Client Hello message are written.

bytesReturned
Int32

Returns the number of bytes written to tlsClientHelloBytesDestination. Or can return the size of the buffer needed if tlsClientHelloBytesDestination wasn't large enough.

Returns

True, if fetching TLS client hello was successful, false if tlsClientHelloBytesDestination size is not large enough. If unsuccessful for other reason throws an exception.

Exceptions

Any HttpSys error except for ERROR_INSUFFICIENT_BUFFER or ERROR_MORE_DATA.

If HttpSys does not support querying the TLS Client Hello.

Remarks

Works only if HTTP_SERVICE_CONFIG_SSL_FLAG_ENABLE_CACHE_CLIENT_HELLO flag is set on http.sys service configuration. See https://learn.microsoft.com/windows/win32/api/http/nf-http-httpsetserviceconfiguration and https://learn.microsoft.com/windows/win32/api/http/ne-http-http_service_config_id

If you don't want to guess the required tlsClientHelloBytesDestination size before first invocation, you should first call with tlsClientHelloBytesDestination set to empty size, so that you can retrieve the required buffer size from bytesReturned, then allocate that amount of memory and retry the query.

Applies to