Encryption#
- minecraft.networking.encryption.create_cipher(shared_secret)#
Create a cipher for encrypting and decrypting packets.
- Parameters:
shared_secret (bytes) – The shared secret.
- Returns:
The cipher to use for encryption and decryption.
- Return type:
- minecraft.networking.encryption.encrypt_secret_and_token(public_key: bytes, shared_secret: bytes, verify_token: bytes) tuple[bytes, bytes]#
Encrypt the shared secret and verify token using the server’s public key.
- minecraft.networking.encryption.generate_hash(server_id: str, shared_secret: bytes, public_key: bytes) str#
Generate the hash for the session server.
Generate a random 16-byte shared secret.
This is just a convenience method, and only does
os.urandom(16).- Returns:
The random 16-byte shared secret.
- Return type:
- minecraft.networking.encryption.minecraft_hexdigest(sha) str#
Convert a SHA1 hash to a Minecraft hexdigest.
- Parameters:
sha (hashlib.sha1) – The SHA1 hash to convert.
- Returns:
The hexdigest.
- Return type:
- async minecraft.networking.encryption.process_encryption_request(packet: EncryptionRequest, connection: Connection)#
Processes an encryption request packet.