mirror of
https://github.com/Grasscutters/Grasscutter.git
synced 2025-12-17 09:25:06 +01:00
Add a dictionary for Encryption public keys (#1862)
This commit is contained in:
@@ -154,8 +154,12 @@ public final class RegionHandler implements Router {
|
||||
}
|
||||
|
||||
String key_id = ctx.queryParam("key_id");
|
||||
|
||||
if(key_id == null)
|
||||
throw new Exception("Key ID was not set");
|
||||
|
||||
Cipher cipher = Cipher.getInstance("RSA/ECB/PKCS1Padding");
|
||||
cipher.init(Cipher.ENCRYPT_MODE, key_id.equals("3") ? Crypto.CUR_OS_ENCRYPT_KEY : Crypto.CUR_CN_ENCRYPT_KEY);
|
||||
cipher.init(Cipher.ENCRYPT_MODE, Crypto.EncryptionKeys.get(Integer.valueOf(key_id)));
|
||||
var regionInfo = Utils.base64Decode(event.getRegionInfo());
|
||||
|
||||
//Encrypt regionInfo in chunks
|
||||
|
||||
@@ -114,8 +114,7 @@ public class HandlerGetPlayerTokenReq extends PacketHandler {
|
||||
.putLong(Crypto.ENCRYPT_SEED ^ client_seed)
|
||||
.array();
|
||||
|
||||
//Kind of a hack, but whatever
|
||||
cipher.init(Cipher.ENCRYPT_MODE, req.getKeyId() == 3 ? Crypto.CUR_OS_ENCRYPT_KEY : Crypto.CUR_CN_ENCRYPT_KEY);
|
||||
cipher.init(Cipher.ENCRYPT_MODE, Crypto.EncryptionKeys.get(req.getKeyId()));
|
||||
var seed_encrypted = cipher.doFinal(seed_bytes);
|
||||
|
||||
Signature privateSignature = Signature.getInstance("SHA256withRSA");
|
||||
|
||||
Reference in New Issue
Block a user