Add RSA configuration parameters to ConfigLoader

This commit is contained in:
Dark98 committed 2026-11-15 02:14:04 +00:00
1 parent 2bacdcc0f7
commit 741a88cb19
3 files changed
+23 -3

No files matched your search

+3 -1
View File
@@ -25,7 +25,9 @@
"item_requirements": true,
"max_players": 200,
"cycle_logging": true,
"cycle_logging_tick": 10
"cycle_logging_tick": 10,
"rsa_exponent": "",
"rsa_modulus": ""
},
"discord": {
"token": "",
@@ -2,10 +2,12 @@ package com.rs2;
import com.rs2.event.impl.ServerConfigEvent;
import com.rs2.game.players.Player;
import org.apollo.net.NetworkConstants;
import org.json.JSONArray;
import org.json.JSONObject;
import java.io.*;
import java.math.BigInteger;
import java.nio.charset.StandardCharsets;
import java.nio.file.Files;
import java.nio.file.Paths;
@@ -89,5 +91,21 @@ public class ConfigLoader {
}
bindBoolean(core, "cycle_logging", val -> Constants.CYCLE_LOGGING = val);
bindInt(core, "cycle_logging_tick", val -> Constants.CYCLE_LOGGING_TICK = val);
bindString(core, "rsa_exponent", val -> {
try {
Constants.RSA_EXPONENT = new BigInteger(val.trim());
NetworkConstants.RSA_EXPONENT = Constants.RSA_EXPONENT;
} catch (Exception e) {
System.err.println("Invalid 'rsa_exponent' in configuration: " + e.getMessage());
}
});
bindString(core, "rsa_modulus", val -> {
try {
Constants.RSA_MODULUS = new BigInteger(val.trim());
NetworkConstants.RSA_MODULUS = Constants.RSA_MODULUS;
} catch (Exception e) {
System.err.println("Invalid 'rsa_modulus' in configuration: " + e.getMessage());
}
});
}
}
@@ -95,12 +95,12 @@ public class Constants {
/**
* The exponent used when decrypting the RSA block.
*/
public static final BigInteger RSA_EXPONENT = new BigInteger("33280025241734061313051117678670856264399753710527826596057587687835856000539511539311834363046145710983857746766009612538140077973762171163294453513440619295457626227183742315140865830778841533445402605660729039310637444146319289077374748018792349647460850308384280105990607337322160553135806205784213241305");;
public static BigInteger RSA_EXPONENT = new BigInteger("33280025241734061313051117678670856264399753710527826596057587687835856000539511539311834363046145710983857746766009612538140077973762171163294453513440619295457626227183742315140865830778841533445402605660729039310637444146319289077374748018792349647460850308384280105990607337322160553135806205784213241305");
/**
* The modulus used when decrypting the RSA block.
*/
public static final BigInteger RSA_MODULUS = new BigInteger("91553247461173033466542043374346300088148707506479543786501537350363031301992107112953015516557748875487935404852620239974482067336878286174236183516364787082711186740254168914127361643305190640280157664988536979163450791820893999053469529344247707567448479470137716627440246788713008490213212272520901741443");;
public static BigInteger RSA_MODULUS = new BigInteger("91553247461173033466542043374346300088148707506479543786501537350363031301992107112953015516557748875487935404852620239974482067336878286174236183516364787082711186740254168914127361643305190640280157664988536979163450791820893999053469529344247707567448479470137716627440246788713008490213212272520901741443");
public final static int ATTACK = 0, DEFENCE = 1, STRENGTH = 2,