Digging into "Multiplayer Secure Chat Signing" #158
yushijinhun
started this conversation in
Ideas
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Introduction
In 22w17a, Mojang introduced the "Multiplayer Secure Chat Signing" feature. According to the release notes:
Implementation details
Key pair retrieval
To retrieve the user's signing key pair, Minecraft sends a
POST
request tohttps://api.minecraftservices.com/player/certificates
with the HTTP headerAuthorization: Bearer <access_token>
and an empty request body.The response is a JSON object containing the user's dedicated private & public key and Mojang's signature:
publicKeySignature
is a signaure of the following text:The signing public key can be found in the file
yggdrasil_session_pubkey.der
ofauthlib-3.4.40.jar
. The signature algorithm isSHA1withRSA
.After retrieval, the key pair is stored in
.minecraft/profilekeys
(e.g..minecraft/profilekeys/4214aad9-5983-457f-aa37-11bb06057270.json
).Key pair retrieval is done on Minecraft startup (in a separate thread). Once retrieved, Minecraft uses the cached key pair until it's time to refresh it.
Login
When a player joins a Minecraft server, its signing public key is sent to the server.
The new process of joining a server:
enforce-secure-profile
is set totrue
and the signing public key is missing, the server will disconnect the client.https://sessionserver.mojang.com/session/minecraft/join
https://sessionserver.mojang.com/session/minecraft/hasJoined
Key distribution
After login, the server puts a
publicKey
property into the player's profile, and distribute it to other players:publicKey
expiresAt.toEpochMilli() + keyPair.publicKey
When the client receives other players' signing public keys, it will check the validity of the key.
Signing
Each chat message sent to the server is signed with the player's signing key.
When signing, the client creates the signature in the following approach:
The signature and the salt is sent to the server along with the chat message, and the server forwards them to receivers.
Note that the server doesn't check whether the chat message signature is valid.
Verifying
When the client receives a chat message from other players, it verifies the message's signature, and logs a warning if it's invalid.
See also
Beta Was this translation helpful? Give feedback.
All reactions