Skip to content

Repository files navigation

FastTLS 0.1.0 [ALPHA-2026-09] — Ultra-Fast TLS Engine for Java

Status Java Platform License: MIT JitPack


⚡ Ultra-fast TLS/HTTPS transport for the FastJava ecosystem.

FastTLS provides a stable asynchronous handshake API for HTTPS clients, telemetry gateways and service-to-service communication. It uses the portable JDK provider today while reserving a native SChannel/OpenSSL backend for low-latency Windows deployments.

Run the TLS Capability Demo | Run the TLS Context Benchmark


Quick Start

import fasttls.FastTLS;

public class Example {
    public static void main(String[] args) {
        try (var socket = FastTLS.connect("example.com", 443).join()) {
            System.out.println("Negotiated: " + socket.getSession().getProtocol());
        } catch (Exception exception) {
            throw new RuntimeException(exception);
        }
    }
}

Table of Contents


Why FastTLS?

TLS is essential for modern services, but secure connection setup can become expensive when clients open many short-lived channels:

  • Handshake latency: Repeated negotiation delays small API calls and telemetry bursts.
  • Provider overhead: A portable provider may leave platform crypto acceleration unused.
  • Transport coupling: Application code becomes difficult to migrate when security and sockets are inseparable.

FastTLS addresses this with a stable security boundary:

  • Asynchronous handshakes: Connection setup completes through CompletableFuture without blocking callers.
  • Modern protocol surface: The API is ready for TLS 1.3, SNI and ALPN-based HTTPS clients.
  • Native-ready backend: SChannel and OpenSSL can replace the JDK provider without changing users of the facade.

Features

  • ⚡ Asynchronous handshakes: Create and negotiate secure sockets without blocking application threads.
  • 🔒 TLS 1.3-capable provider: Uses the active Java security provider as a portable fallback.
  • 🌐 HTTPS-ready boundary: Supports the transport needs of SNI and ALPN-aware clients.
  • 🔗 Ecosystem ready: Sits directly above FastNet and beside FastCrypto primitives.

Real-World Scenarios

  • HTTPS clients: Establish secure connections to web APIs and service endpoints.
  • Telemetry gateways: Encrypt device data before it reaches FastNet transport.
  • Game backends: Protect authentication and control channels while keeping data paths separate.
  • Internal services: Use native provider acceleration for high-volume service-to-service calls.

Performance Benchmarks

FastTLS includes a local context benchmark and a capability demo; network handshake figures should be measured against the target service and provider.

Metric / Security Type Current Java Fallback Native Target
TLS context setup Measured by benchmark SChannel/OpenSSL
HTTPS handshake JDK provider Native handshake path
Record processing Provider-managed buffers Zero-copy native path

The included benchmark measures local provider setup. Native handshake and record figures are reported only after the platform backend is integrated.


Measured Benchmark Run

The optimized local benchmark completed 1,000 SSL context accesses in 179.24 ms using the JDK provider with protocol Default; the previous repeated default-context lookup measured 402.17 ms, so context caching reduced this run by about 55%.

run-benchmark.bat -> fasttls.TlsContextBenchmark

This measures provider setup access, not a remote HTTPS handshake; network handshake results depend on the target service and certificate chain.


API Quick Reference

Method Description
Method / Type Description
--------------- -------------
connect(host, port) Creates a TLS socket and completes its handshake asynchronously.
TLSException Wraps transport and handshake failures with a stable API error.

Technical Examples & Hero Demos

Case Java Example Launcher Description
TLS Provider Capabilities TlsCapabilitiesDemo.java run-demo.bat Reports the active provider and protocol used by the local runtime.
TLS Context Preparation TlsContextBenchmark.java run-benchmark.bat Measures repeated context access for HTTPS service clients.

Installation

Option 1: Maven (Recommended)

<repositories>
    <repository>
        <id>jitpack.io</id>
        <url>https://jitpack.io</url>
    </repository>
</repositories>
<dependencies>
    <dependency>
    <groupId>com.github.andrestubbe</groupId>
    <artifactId>FastTLS</artifactId>
    <version>0.1.0</version>
</dependency>
</dependencies>

Option 2: Gradle (via JitPack)

repositories {
    maven { url 'https://jitpack.io' }
}

dependencies {
    implementation 'com.github.andrestubbe:FastTLS:0.1.0'
}

Option 3: Direct Download (No Build Tool)

Download the latest FastTLS JAR from the GitHub releases page.


Documentation


Platform Support

Platform Status
Windows 10/11 x64 Native SChannel planned
Linux JDK TLS fallback
macOS JDK TLS fallback

License

MIT License — See LICENSE for details.


Related Projects


Part of the FastJava EcosystemMaking the JVM faster. Small package. Maximum speed. Zero bloat. 🚀📋

About

⚡ Ultra-fast native-ready TLS engine for Java — asynchronous HTTPS handshakes, TLS 1.3 transport, SChannel/OpenSSL integration, and secure low-latency services.

Topics

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages