Skip to content

Encryption 1.17 forward

Niclas Olofsson edited this page Jun 26, 2021 · 1 revision

The encryption from bedrock version 1.17 and forward changed. The new encryption use standard AES CRT non-blocking cipher, however it is used in a non standard way. Some notes on the implementation in MiNET.

Cipher

Uses a stream-enabled version of CRT, based Bouncy Castle, but modified according to a stack overflow answer you can find here https://stackoverflow.com/questions/51286633/java-bc-sicblockcipher-direct-output-equivalent-in-c-sharp

Encryption/Decryption

The CRT implementation in Bouncy Castle normally require you to terminate the encryption session in order to output the finished, encrypted message. However, since bedrock is implemented as a stream-based crypto, this doesn't actually work. So the code for encrypting and decrypting keeps the crypto context live throughout the entire session with the player (client).

IV

The optimal IV for CRT is 12 bytes long. However, the implementation require 16 bytes. Hence an additional 4 bytes, ending with a 0x02, are added to the finished IV.