PaperMC

Minecraft 26.4 Replaced Its Decade-Old Login Crypto. Here's What key-rotation-period-seconds Actually Does.

26.4 Snapshot 9 rewrote how a Java Edition client and server agree on an encryption key. RSA-1024 is out, X25519 is in, and a new key-rotation-period-seconds setting decides how often the server's key changes. I opened the snapshot server jar, timed the login crypto, and checked what changes for...

a bunch of keys sitting on top of a wooden table
Photo by Filip Szalbot / Unsplash

For more than a decade, every online-mode Minecraft server has done the same thing on startup: print Generating keypair and make one 1024-bit RSA key. That key protects every player login until the server restarts, which on a well-run server might be weeks. Most server owners have never thought about it. It doesn't show up in server.properties.

That changed on November 17. Mojang's changelog for 26.4 Snapshot 9 says only "Changed encryption key establishment procedure" and adds one new property, key-rotation-period-seconds. Two lines. I opened the server jar to see what they mean.

What Changed in the Minecraft 26.4 Login

Mojang now ships the server jar with readable class names, so you can compare versions directly. I extracted the 26.3 and Snapshot 9 server jars from Mojang's version manifest and read the crypto classes with javap:

26.3 26.4 Snapshot 9
Key exchange RSA, 1024-bit, encrypting a client-chosen secret X25519 (XDH) Diffie-Hellman
Server key lifetime Generated once at startup Rotated, every 60 s by default
Key derivation None. The shared secret is the AES key HKDF-SHA256, with HmacSHA256 for authentication and integrity
Stream cipher AES/CFB8/NoPadding AES/CFB8/NoPadding
Cipher keys One key, used both ways, also used as the IV Separate keys for each direction (a_to_b, b_to_a), separate IVs
Auth hash for Mojang's session server SHA-1 No SHA-1 string left in the net.minecraft classes

The old design is visible in one method. In 26.3, Crypt.getCipher builds its IV from the key itself:

         0: ldc           #219                // String AES/CFB8/NoPadding
         2: invokestatic  #213                // Method javax/crypto/Cipher.getInstance:(Ljava/lang/String;)Ljavax/crypto/Cipher;
         5: astore_2
         6: aload_2
         7: iload_0
         8: aload_1
         9: new           #221                // class javax/crypto/spec/IvParameterSpec
        12: dup
        13: aload_1
        14: invokeinterface #223,  1          // InterfaceMethod java/security/Key.getEncoded:()[B
        19: invokespecial #224                // Method javax/crypto/spec/IvParameterSpec."<init>":([B)V

IvParameterSpec(key.getEncoded()): the key and the IV are the same bytes, in both directions. In Snapshot 9 that class is gone. Its replacement, StreamCryptoUtils.getCipher, takes the IV as a separate argument, and SessionKeys holds four keys: one for each stream direction, one for authentication, and one for integrity.

The cipher is still AES-CFB8, so traffic is still unauthenticated at the packet level. What changed is how the two sides get their keys, and how long a key lives.

What key-rotation-period-seconds Does

The new ServerSideFactory class holds the server's X25519 key pair and a minRekeyTimeMs. Its rekeyIfNeeded method runs when a new connection starts:

  • If the period is 0, it makes a new key pair for that connection.
  • Otherwise, if more than the period has passed since the last new key, it makes one.

So the setting is a minimum, as the changelog says: "the minimum duration after which server keys (used for establishing new connections) will be recreated." On a quiet server, the key may live much longer than 60 seconds, because nothing triggers the check.

Why it matters: with 26.3's single RSA key, anyone who recorded login traffic and later got that private key, from a memory dump or a compromised host, could recover the AES key for every session since startup. With ephemeral X25519, a stolen server key only exposes connections that used it: one connection at 0, or one rotation window at the default.

We recommend reading Minecraft 26.3 Turned the Whitelist On. Your Server Probably Didn't Notice. to continue reading our selection of content. It covers the last time a release quietly changed a security default in server.properties.

Minecraft 26.3 Turned the Whitelist On. Your Server Probably Didn't Notice. Minecraft 26.3 enables the whitelist by default, but upgraded servers keep white-list=false. The security-relevant defaults, tested. SudoSecurity · Santhdium

What It Costs: The Login Crypto, Timed

The worry with "a new key for every connection" is CPU. I timed the public-key work a server does per login, using the same JDK algorithms the server code names. This is my own benchmark, using only the standard Java crypto API:

// Times the public-key work a Minecraft server does per login: RSA-1024 decryption (26.3)
// versus X25519 key agreement, with and without a fresh key pair (26.4 Snapshot 9).
import java.security.*;
import javax.crypto.Cipher;
import javax.crypto.KeyAgreement;

public class LoginCryptoBench {
    interface Op { void run() throws Exception; }

    static double usPerOp(Op op) throws Exception {
        for (int i = 0; i < 20_000; i++) op.run();                  // warm-up
        int n = 0;
        long t0 = System.nanoTime();
        while (System.nanoTime() - t0 < 3_000_000_000L) { op.run(); n++; }
        return (System.nanoTime() - t0) / 1e3 / n;
    }

    public static void main(String[] args) throws Exception {
        // 26.3: one RSA-1024 key pair for the server's lifetime; each login decrypts two RSA blocks.
        KeyPairGenerator rsaGen = KeyPairGenerator.getInstance("RSA");
        rsaGen.initialize(1024);
        KeyPair rsa = rsaGen.generateKeyPair();
        Cipher enc = Cipher.getInstance("RSA/ECB/PKCS1Padding");
        enc.init(Cipher.ENCRYPT_MODE, rsa.getPublic());
        byte[] secret = enc.doFinal(new byte[16]);
        byte[] token = enc.doFinal(new byte[4]);
        Cipher dec = Cipher.getInstance("RSA/ECB/PKCS1Padding");
        dec.init(Cipher.DECRYPT_MODE, rsa.getPrivate());
        double rsaLogin = usPerOp(() -> { dec.doFinal(secret); dec.doFinal(token); });

        // Snapshot 9: X25519. The client brings its own key pair; the server agrees on a secret.
        KeyPairGenerator xGen = KeyPairGenerator.getInstance("XDH");
        xGen.initialize(java.security.spec.NamedParameterSpec.X25519);
        KeyPair server = xGen.generateKeyPair();
        KeyPair client = xGen.generateKeyPair();
        double xAgree = usPerOp(() -> {
            KeyAgreement ka = KeyAgreement.getInstance("XDH");
            ka.init(server.getPrivate());
            ka.doPhase(client.getPublic(), true);
            ka.generateSecret();
        });
        double xKeygen = usPerOp(xGen::generateKeyPair);
        double rsaKeygen = usPerOp(() -> rsaGen.generateKeyPair());

        System.out.printf("26.3  RSA-1024 decrypts per login:            %8.1f us%n", rsaLogin);
        System.out.printf("26.4  X25519 agreement per login (rotation 60): %6.1f us%n", xAgree);
        System.out.printf("26.4  plus new X25519 key pair (rotation 0):    %6.1f us%n", xAgree + xKeygen);
        System.out.printf("      RSA-1024 key pair generation:             %6.1f us%n", rsaKeygen);
    }
}

On Temurin 25.0.5, on one core of a 2-vCPU cloud VM:

26.3  RSA-1024 decrypts per login:               341.5 us
26.4  X25519 agreement per login (rotation 60):  137.4 us
26.4  plus new X25519 key pair (rotation 0):     282.0 us
      RSA-1024 key pair generation:             11327.3 us

A second run gave 301.1, 141.0, 274.1 and 9,822.9 µs.

The new login is cheaper than the old one, even at 0. A fresh X25519 key pair plus the agreement costs less than the two RSA-1024 decryptions 26.3 did for every login. For comparison, generating an RSA-1024 key pair took 10 to 11 milliseconds, 35 to 40 times the whole X25519 cost, which is why 26.3 only did it once. X25519 key pairs are cheap enough to throw away.

These are the asymmetric operations only. I didn't time the HKDF and HMAC steps, which are hashing and far cheaper than either key operation.

What to Set

For most servers, leave it at 60. A bot flood of new connections at 0 costs about 0.3 ms of CPU each on my test machine, which is noise next to everything else a login does. But 60 already shrinks the window from "since the last restart" to about a minute, and that's most of the benefit.

Set 0 if you run a server where login privacy matters more than usual, such as a staff or admin server. Raising it above 60 buys nothing measurable.

Snapshot 9 wrote this to a new server.properties:

key-rotation-period-seconds=60

The setting only matters in online mode. In Snapshot 9's ServerLoginPacketListenerImpl, the key exchange starts only when usesAuthentication() is true and the connection isn't a local in-memory one. Offline-mode logins skip it, just as they skipped encryption before.

The other new properties in 26.4

Comparing a fresh Snapshot 9 server.properties with a fresh 26.3 one turns up four new keys. The other three arrived in Snapshot 1 on September 22:

Property Default What it does
key-rotation-period-seconds 60 Minimum time before the login key is replaced. 0 means a new key per connection
allowed-connection-ids empty When set, rejects status and login connections whose address doesn't carry a matching _id
enable-legacy-status true Answers the pre-1.7 server-list ping. Set false if you don't need it
status-contact-details empty Free text returned as contact in the status response

allowed-connection-ids looks like access control, but it isn't. The ID travels in the handshake's host field, before encryption starts. Mojang's own Snapshot 1 notes warn that these values shouldn't be used for anything security-sensitive. It's useful for hiding from casual scanners, and it's no replacement for the whitelist.

We recommend reading Bukkit, Spigot, Paper, Folia: What You're Actually Running to continue reading our selection of content. Every fork on that list has to reimplement this handshake before it can run 26.4.

Bukkit, Spigot, Paper, Folia: What You're Actually Running Bukkit, Spigot, Paper, Pufferfish, Purpur, Folia and Leaf compared at the code level — API lineage, DAB internals, and Folia's threading. SudoSecurity · Santhdium

What Breaks: Proxies and Bridges

Anything that does the client-facing half of the login has to implement the new handshake before 26.4 clients can connect through it. That's how proxies and bridges work, so it covers:

  • Velocity and BungeeCord, which do the encrypted login with the player and then talk to backends in offline mode.
  • Geyser, which logs into a Java server as a Java client for each Bedrock player.
  • Server forks like Paper, which carry Mojang's login code and will pick it up when they update to 26.4.

The new login also adds packets: ClientboundKeyPacket replaces ClientboundHelloPacket, plus new ConnectionOptionsPacket, ClientboundApplyOptionsPacket and ServerboundOptionsAppliedPacket. Expect a gap between the 26.4 release and proxy support, as there is with most protocol changes. If your network depends on a proxy, don't let clients update before it does.

What This Doesn't Cover

I read class names, string constants and bytecode with javap. I didn't decompile the full login flow or test a real client, because no released client speaks this protocol yet outside the snapshot launcher. The benchmark times the JDK operations the classes name, not Minecraft's own login path end to end. It's a fair comparison of the asymmetric cost, not a full login timing.

This is a snapshot. Mojang can change any of it before 26.4 ships. Snapshot 10, released the same day, had byte-identical copies of the four crypto classes I compared. I haven't checked the proxy projects' plans for 26.4.

The Actual Point

Minecraft's login went from a single long-lived RSA-1024 key, with the AES key doubling as its own IV, to ephemeral X25519 with proper key derivation. The changelog gave it five words. Server owners get one dial, key-rotation-period-seconds, and the default of 60 is a fine place to leave it.

The work lands on proxy and bridge maintainers. Plan your 26.4 upgrade around them, not around Mojang's release date.

Changelog quotes are from Mojang's 26.4 Snapshot 9 and Snapshot 1 notes, via Patchbot's Snapshot 9 copy and Snapshot 1 copy. The server jars are 26.3, 26.4 Snapshot 9 and Snapshot 10, downloaded on November 19, 2026 through Mojang's version manifest at piston-meta.mojang.com. The bytecode excerpt is reproduced from javap -c output for net.minecraft.util.Crypt in the 26.3 server jar, and the class, method, field and string names cited come from javap on both jars. The server.properties comparison comes from fresh 26.3 and Snapshot 9 servers started in itzg/minecraft-server:java25. The benchmark is original code using the java.security and javax.crypto APIs, run on Temurin 25.0.5 on a 2-vCPU KVM guest, and its output is reproduced from that run.

$ tail -f /forums

Discussion

Comments live on the community forums — sign in there to reply.