Fix whitespace [skip actions]

This commit is contained in:
github-actions
2022-07-21 07:21:22 +00:00
committed by Melledy
parent 510d564bcb
commit ae2d1fe438
166 changed files with 12928 additions and 12928 deletions

View File

@@ -10,25 +10,25 @@ import java.security.spec.X509EncodedKeySpec;
import emu.grasscutter.Grasscutter;
public final class Crypto {
private static final SecureRandom secureRandom = new SecureRandom();
private static final SecureRandom secureRandom = new SecureRandom();
public static byte[] DISPATCH_KEY;
public static byte[] DISPATCH_SEED;
public static byte[] DISPATCH_KEY;
public static byte[] DISPATCH_SEED;
public static byte[] ENCRYPT_KEY;
public static long ENCRYPT_SEED = Long.parseUnsignedLong("11468049314633205968");
public static byte[] ENCRYPT_SEED_BUFFER = new byte[0];
public static byte[] ENCRYPT_KEY;
public static long ENCRYPT_SEED = Long.parseUnsignedLong("11468049314633205968");
public static byte[] ENCRYPT_SEED_BUFFER = new byte[0];
public static PublicKey CUR_OS_ENCRYPT_KEY;
public static PublicKey CUR_CN_ENCRYPT_KEY;
public static PrivateKey CUR_SIGNING_KEY;
public static void loadKeys() {
DISPATCH_KEY = FileUtils.readResource("/keys/dispatchKey.bin");
DISPATCH_SEED = FileUtils.readResource("/keys/dispatchSeed.bin");
public static void loadKeys() {
DISPATCH_KEY = FileUtils.readResource("/keys/dispatchKey.bin");
DISPATCH_SEED = FileUtils.readResource("/keys/dispatchSeed.bin");
ENCRYPT_KEY = FileUtils.readResource("/keys/secretKey.bin");
ENCRYPT_SEED_BUFFER = FileUtils.readResource("/keys/secretKeyBuffer.bin");
ENCRYPT_KEY = FileUtils.readResource("/keys/secretKey.bin");
ENCRYPT_SEED_BUFFER = FileUtils.readResource("/keys/secretKeyBuffer.bin");
try {
//These should be loaded from ChannelConfig_whatever.json
@@ -44,21 +44,21 @@ public final class Crypto {
catch (Exception e) {
Grasscutter.getLogger().error("An error occurred while loading keys.", e);
}
}
}
public static void xor(byte[] packet, byte[] key) {
try {
for (int i = 0; i < packet.length; i++) {
packet[i] ^= key[i % key.length];
}
} catch (Exception e) {
Grasscutter.getLogger().error("Crypto error.", e);
}
}
public static void xor(byte[] packet, byte[] key) {
try {
for (int i = 0; i < packet.length; i++) {
packet[i] ^= key[i % key.length];
}
} catch (Exception e) {
Grasscutter.getLogger().error("Crypto error.", e);
}
}
public static byte[] createSessionKey(int length) {
byte[] bytes = new byte[length];
secureRandom.nextBytes(bytes);
return bytes;
}
public static byte[] createSessionKey(int length) {
byte[] bytes = new byte[length];
secureRandom.nextBytes(bytes);
return bytes;
}
}