3
0
Mirror von https://github.com/GeyserMC/Geyser.git synchronisiert 2024-12-27 08:30:12 +01:00

Merge branch 'floodgate-2.0' of https://github.com/Tim203/Geyser into floodgate-2.0

Dieser Commit ist enthalten in:
Camotoy 2021-01-10 16:02:25 -05:00
Commit 7e63f50fd0
Es konnte kein GPG-Schlüssel zu dieser Signatur gefunden werden
GPG-Schlüssel-ID: 7EEFB66FE798081F

Datei anzeigen

@ -31,6 +31,7 @@ import lombok.RequiredArgsConstructor;
import javax.crypto.Cipher; import javax.crypto.Cipher;
import javax.crypto.SecretKey; import javax.crypto.SecretKey;
import javax.crypto.spec.GCMParameterSpec; import javax.crypto.spec.GCMParameterSpec;
import java.nio.Buffer;
import java.nio.ByteBuffer; import java.nio.ByteBuffer;
import java.security.Key; import java.security.Key;
import java.security.SecureRandom; import java.security.SecureRandom;
@ -99,13 +100,15 @@ public final class AesCipher implements FloodgateCipher {
} }
ivLength = buffer.position() - mark - 1; // don't include the splitter itself ivLength = buffer.position() - mark - 1; // don't include the splitter itself
buffer.position(mark); // reset to the pre-while index // don't remove this cast, it'll cause problems if you remove it
((Buffer) buffer).position(mark); // reset to the pre-while index
} }
byte[] iv = new byte[ivLength]; byte[] iv = new byte[ivLength];
buffer.get(iv); buffer.get(iv);
buffer.position(buffer.position() + 1); // skip splitter // don't remove this cast, it'll cause problems if you remove it
((Buffer) buffer).position(buffer.position() + 1); // skip splitter
byte[] cipherText = new byte[buffer.remaining()]; byte[] cipherText = new byte[buffer.remaining()];
buffer.get(cipherText); buffer.get(cipherText);