Package dev.relism.flash.tls
Class TlsConfig
java.lang.Object
dev.relism.flash.tls.TlsConfig
Declarative TLS configuration for a
FlashConfiguration.Listener.
Two ways in
keystore(Path, String)— Flash builds theSSLContextfrom a PKCS12/JKS keystore. A keystore holding more than one certificate entry gets SNI-based selection for free (seeSniKeyManager) — no per-hostname config needed. Flash also pinsTLSv1.2/TLSv1.3as the enabled protocols; cipher suites are left at the JDK's own curated default, which each JDK security release keeps current — Flash does not maintain its own suite allow-list.ofContext(SSLContext)— escape hatch. The givenSSLContextis used exactly as built: Flash never callssetSSLParameterson this path unless you explicitly callapplicationProtocolsorclientAuthyourself, so anything else you configured on it is 100% authoritative.
clientAuth(ClientAuth) and applicationProtocols(String...) apply on
either path — they are explicit instructions through this API, not Flash-chosen defaults, so
each is only ever applied when called. Neither has a value by default, on either path.
ALPN (e.g. TLS-ALPN-01 / RFC 8737)
applicationProtocols(String...) sets the listener's negotiable protocol list via
SSLParameters.setApplicationProtocols(java.lang.String[]), inherited by every accepted socket exactly like
ClientAuth — no per-connection code needed. ALPN is resolved during ClientHello
processing/ServerHello production, which always precedes Certificate production
— so a custom X509ExtendedKeyManager deciding which certificate to serve
can read the client's negotiated protocol via engine.getHandshakeApplicationProtocol()
(or ((SSLSocket) socket).getHandshakeApplicationProtocol()) inside
chooseEngineServerAlias/chooseServerAlias and it is already resolved by then.-
Method Summary
Modifier and TypeMethodDescriptionapplicationProtocols(String... protocols) ALPN protocols this listener negotiates, in preference order (e.g.voidapplyTo(SSLServerSocket socket) clientAuth(ClientAuth mode) Client-certificate requirement.static TlsConfigBuilds anSSLContextfrom a PKCS12/JKS keystore — type is guessed from the file extension (.jksmeans JKS, anything else PKCS12).static TlsConfigofContext(SSLContext context) Escape hatch — see class Javadoc.
-
Method Details
-
keystore
Builds anSSLContextfrom a PKCS12/JKS keystore — type is guessed from the file extension (.jksmeans JKS, anything else PKCS12). The private-key password is assumed equal to the store password, the common case for PKCS12. -
ofContext
Escape hatch — see class Javadoc. Flash applies nothing to the socket beyond what you explicitly call (clientAuth/applicationProtocols) on this instance. -
clientAuth
Client-certificate requirement. Applies on either construction path — see class Javadoc. -
applicationProtocols
ALPN protocols this listener negotiates, in preference order (e.g."acme-tls/1", "http/1.1"). Applies on either construction path — see class Javadoc for how a customKeyManagerobserves the negotiated value. -
serverSocketFactory
-
applyTo
-