Class FingerprintSslContext

java.lang.Object
io.github.mahmoudimus.quic.tls.FingerprintSslContext

public final class FingerprintSslContext extends Object
An SSLContext for TLS clients that present a browser's fingerprint: its sockets' handshakes are a ClientHelloProfile's, such as BrowserProfiles.chrome156(), so a server sees that browser's ClientHello (cipher suites, extensions and their order, GREASE, key shares) where it would see the JDK's. Anything that takes an SSLContext for client connections can use one; only client sockets are offered (SSLContext.getSocketFactory()), not server sockets or SSLEngines.

 SSLContext chrome = FingerprintSslContext.builder(BrowserProfiles.chrome156())
         .trustManager(trustManager)
         .certificateDecompressor(brotli)
         .build();
 

Sockets made from the context share its session tickets, by server name and port, and resume with them as the browser would, after rechecking the current acceptance policy and peer identity. Client-authenticated sessions and delegated-credential sessions require a full handshake because the cached TCP ticket does not retain all authentication context.

Enabled cipher suites and SSLParameters.getAlgorithmConstraints() govern acceptance without changing the captured ClientHello. The JDK's current jdk.tls.disabledAlgorithms property is read for each handshake; unsupported restrictions fail closed. CBC is always refused, even when retained in the browser's wire profile.

  • Method Details

    • isFingerprint

      public static boolean isFingerprint(SSLContext context)
      Whether context was built here (FingerprintSslContext.Builder.build()), so that its sockets present a browser's ClientHello: told by the context's provider, which only such contexts have.
      Parameters:
      context - the context, or null
      Returns:
      true for a context this class built
    • builder

      public static FingerprintSslContext.Builder builder(ClientHelloProfile profile)
      A builder for a context with profile's ClientHello.
      Parameters:
      profile - the ClientHello to present
      Returns:
      the builder