0x01 C01PacketEncryptionResponse

Responds to the server's encryption request with the shared secret (RSA-encrypted with the server's public key) and verify token.

Serverbound (Client → Server) · LOGIN · net/minecraft/network/login/client/C01PacketEncryptionResponse.java

Published 2026-06-18 · Updated 2026-10-14

loginauthenticationencryptionsecurity
Complete 6/8

Fields

FieldTypeDescription
sharedSecretbyte[]Encrypted shared secret (AES key encrypted with server's RSA public key)
verifyTokenbyte[]Encrypted verify token (random challenge encrypted with server's RSA public key)

Wire Encoding

FieldTypeNotes
Shared Secret LengthVarIntLength of encrypted secret
Shared Secretbyte[]Encrypted with server's RSA public key
Verify Token LengthVarIntLength of encrypted token
Verify Tokenbyte[]Encrypted with server's RSA public key

MCP References

MCPNetHandlerLoginServer.processEncryptionResponse()

Handler Interface

HNDINetHandlerLoginServer

Vanilla Source

C01PacketEncryptionResponse.java62 lines · MCP 1.8.9Original ↗
1
package net.minecraft.network.login.client;
2
3
import java.io.IOException;
4
import java.security.PrivateKey;
5
import java.security.PublicKey;
6
import javax.crypto.SecretKey;
7
import net.minecraft.network.Packet;
8
import net.minecraft.network.PacketBuffer;
9
import net.minecraft.network.login.INetHandlerLoginServer;
10
import net.minecraft.util.CryptManager;
11
12
public class C01PacketEncryptionResponse implements Packet<INetHandlerLoginServer>
13
{
14
    private byte[] secretKeyEncrypted = new byte[0];
15
    private byte[] verifyTokenEncrypted = new byte[0];
16
17
    public C01PacketEncryptionResponse()
18
    {
19
    }
20
21
    public C01PacketEncryptionResponse(SecretKey secretKey, PublicKey publicKey, byte[] verifyToken)
22
    {
23
        this.secretKeyEncrypted = CryptManager.encryptData(publicKey, secretKey.getEncoded());
24
        this.verifyTokenEncrypted = CryptManager.encryptData(publicKey, verifyToken);
25
    }
26
27
    /**
28
     * Reads the raw packet data from the data stream.
29
     */
30
    public void readPacketData(PacketBuffer buf) throws IOException
31
    {
32
        this.secretKeyEncrypted = buf.readByteArray();
33
        this.verifyTokenEncrypted = buf.readByteArray();
34
    }
35
36
    /**
37
     * Writes the raw packet data to the data stream.
38
     */
39
    public void writePacketData(PacketBuffer buf) throws IOException
40
    {
41
        buf.writeByteArray(this.secretKeyEncrypted);
42
        buf.writeByteArray(this.verifyTokenEncrypted);
43
    }
44
45
    /**
46
     * Passes this Packet on to the NetHandler for processing.
47
     */
48
    public void processPacket(INetHandlerLoginServer handler)
49
    {
50
        handler.processEncryptionResponse(this);
51
    }
52
53
    public SecretKey getSecretKey(PrivateKey key)
54
    {
55
        return CryptManager.decryptSharedKey(key, this.secretKeyEncrypted);
56
    }
57
58
    public byte[] getVerifyToken(PrivateKey key)
59
    {
60
        return key == null ? this.verifyTokenEncrypted : CryptManager.decryptData(key, this.verifyTokenEncrypted);
61
    }
62
}

Deobfuscated MCP 1.8.9 source of C01PacketEncryptionResponse, fetched directly from Marcelektro/MavenMCP-1.8.9 (net/minecraft/network/login/client/C01PacketEncryptionResponse.java) at build time and verified present.

Deep Dive

Role in the protocol

C01PacketEncryptionResponse is the second LOGIN-state packet and the last plaintext packet on the connection. The client generates a random AES secret, RSA-encrypts it together with the verify token from S01PacketEncryptionRequest using the server's public key, and sends both byte arrays. The server decrypts with its private key, checks the nonce, and enables symmetric AES encryption on the channel from that point on. In 1.8.9 this is where the session service join happens: the server hashes server id, public key and secret, and calls hasJoinedServer to resolve the profile UUID.

Vanilla handling

NetHandlerLoginServer.processEncryptionResponse validates the state is KEY, decrypts the verify token with the private key, and throws IllegalStateException('Invalid nonce!') unless it matches the stored field_147330_e. It then stores the secret key, enables encryption on the NetworkManager, and spawns a 'User Authenticator' thread that computes the server-id hash and calls getMinecraftSessionService().hasJoinedServer. A null profile closes with 'Failed to verify username!'; a success moves to READY_TO_ACCEPT and sends S02PacketLoginSuccess.

Why clients touch it

Two clients reference this packet, for opposite reasons. Rise 6.1.30 and 6.2.4 BlinkComponent list it in the pre-play exemption set, again as a buffering exemption: blink must not hold it because the server sits in KEY state until encryption is enabled. LiquidSense Dev reimplements the send itself: MixinNetHandlerLoginClient intercepts S01PacketEncryptionRequest and calls ClientUtils.sendEncryption, which builds C01PacketEncryptionResponse and sends it with a callback that enables encryption on the NetworkManager. No module in the corpus cancels, mutates or replays the packet, and there is no field worth spoofing: the nonce is server-issued and RSA-protected, so a tampered secret simply fails the nonce check or produces garbage decryption server-side. The 8 classic clients treat encryption as untouchable infrastructure; their disablers and ping spoofers all operate in the PLAY state where the stream is already encrypted.

Exploit surface

The genuine abuse vector lives on the other side of the exchange: a malicious server can present its own RSA key in S01PacketEncryptionRequest and the client will happily encrypt the session to it, enabling MITM for session hijacking. That is a phishing problem, not a packet-level one, and no module in the corpus touches either side. The only client-side interaction is defensive: blink must not buffer this packet, because holding it would leave the server waiting in KEY state until the login timeout.

Server-Side Handling

processEncryptionResponse: Validate.validState(KEY), decrypt verify token with the private key and compare against the stored nonce (throw on mismatch), store the AES secret, enable encryption on the channel, then authenticate asynchronously via hasJoinedServer with the server-id hash. Failures close the connection with 'Failed to verify username!'.

Protocol Analysis

LOGIN state, id 0x01. Two VarInt-length-prefixed byte arrays: the RSA-encrypted AES secret and the RSA-encrypted verify token, both PKCS1-padded by CryptManager. Must follow S01PacketEncryptionRequest; sending it without a pending KEY state throws. Immediately after this packet the entire stream switches to AES/CFB8, so every later packet is opaque on the wire.

Anti-Cheat Landscape

Not an anti-cheat surface at all: no gameplay data, no timing hooks, and the exchange is protected by the server's own nonce. Proxy setups (BungeeCord with forced hosts) use the secret to key their own encryption layer, but nothing in the 8 clients interacts with that. The practical flagging surface is zero, which is why only BlinkComponent's defensive exemption appears in the corpus.

implementation Implementation Cases

The RSA handshake closer: client sends encrypted AES secret plus verify token, server nonce-checks and enables symmetric encryption. Corpus hits are Rise 6.x BlinkComponent's exemption and LiquidSense Dev's mixin-driven reimplementation of the send; no module cancels or spoofs it because there is nothing to gain and everything to lose.

BlinkComponent (Rise 6.1.30, Rise 6.2.4)

Exempt C01PacketEncryptionResponse from blink buffering so the encryption exchange always completes and the connection actually becomes encrypted.

The PacketSendEvent listener's hard-coded pre-play exemption list includes C01PacketEncryptionResponse; the packet returns untouched and is never parked in the blink queue, so the login continues to the READY_TO_ACCEPT state normally.

Source: Rise 6.2.4, Client-release2/Client/src/main/java/com/alan/clients/component/impl/player/BlinkComponent.java

Vanilla hook: PacketSendEvent
None: the packet is untouched. The exemption is structural, keeping blink out of the login state machine entirely.
Variations: Rise 6.1.30 is byte-identical. No other client in the corpus references this packet from module code.
ClientUtils (encryption helper) (LiquidSense Dev)

Centralize the encryption handshake send so the login mixin can enable AES on the channel without duplicating the vanilla NetHandlerLoginClient logic.

sendEncryption(networkManager, secretKey, publicKey, encryptionRequest) builds the C01PacketEncryptionResponse from the already-generated AES secret, the server's RSA public key and the request's verify token, sends it through networkManager.sendPacket and enables encryption on the same manager inside the completion callback. The static helper is called from MixinNetHandlerLoginClient's intercept of S01PacketEncryptionRequest.

Source: LiquidSense Dev, net/ccbluex/liquidbounce/utils/ClientUtils.java

Vanilla hook: No event hook: a mixin on NetHandlerLoginClient calls the static utility; the packet goes through the raw NetworkManager with a GenericFutureListener callback.
None: the wire payload is what vanilla sends. The mixin exists to route the flow through LiquidBounce's utility layer, not to alter the handshake.
Variations: Rise 6.x only exempts the packet from blink buffering; LiquidSense Dev is the one corpus client that constructs and sends it outside the vanilla login handler.
PacketSendEvent in Rise 6.x BlinkComponent; LiquidSense Dev hooks the login handler via mixin instead of the event bus.
All other clients leave C01PacketEncryptionResponse to the bundled vanilla NetHandlerLoginClient, which sends it inside a GenericFutureListener callback after the secret key generation; LiquidSense Dev diverts it through ClientUtils.sendEncryption from its login mixin.

anticheat Anti-Cheat Checks

The encryption response closes the RSA handshake and is the last plaintext packet on the connection, so anticheats never flag it. Corpus hits are registrations: Negativity lists ENCRYPTION_BEGIN_IN and ENCRYPTION_BEGIN_OUT in its PacketType enum, Artemis maps PacketLoginClientEncryptionBegin in its PacketRepository, and intave's ServerboundConfirmEncryption belongs to Intave's own cloud-control channel with its own cipher pipeline, not to the Minecraft login exchange. After this packet the stream is AES-encrypted and every later anticheat sees ciphertext.

Wiki Cross-Reference

LOGIN serverbound 0x01; two VarInt-length byte arrays: RSA-encrypted AES secret plus encrypted verify token.

Server decrypts with its private key, checks the nonce, then enables AES/CFB8 so later traffic is opaque.

Valid only in KEY state after S01; a bad nonce or failed auth closes the connection instead of joining.

MCP 1.8.9 C01PacketEncryptionResponse implements Packet dispatching to INetHandlerLoginServer.processEncryptionResponse; wire serde is readPacketData/writePacketData via readByteArray.

1.8.9 callers: NetHandlerLoginClient.handleEncryptionRequest sends new C01PacketEncryptionResponse (line 86): https://github.com/Marcelektro/MavenMCP-1.8.9/blob/master/src/main/java/net/minecraft/client/network/NetHandlerLoginClient.java

Cross-checked against minecraft.wiki (CC BY-SA 3.0) for 1.8.9 accuracy.