This commit is contained in:
yushijinhun 2017-12-31 17:21:07 +08:00
parent 3185f73f6b
commit a1a4a3dbc2
No known key found for this signature in database
GPG key ID: 5BC167F73EA558E4
2 changed files with 5 additions and 4 deletions

View file

@ -27,7 +27,7 @@ public final class AuthlibInjector {
private static final String[] nonTransformablePackages = new String[] { "java.", "javax.", "com.sun.",
"com.oracle.", "jdk.", "sun.", "org.apache.", "com.google.", "oracle.", "com.oracle.", "com.paulscode.",
"io.netty.", "org.lwjgl.", "net.java.", "org.w3c.", "javassist." };
"io.netty.", "org.lwjgl.", "net.java.", "org.w3c.", "javassist.", "org.xml." };
private AuthlibInjector() {}
@ -89,7 +89,7 @@ public final class AuthlibInjector {
private static Optional<InjectorConfig> tryRemoteConfig() {
String configProperty = System.getProperty("org.to2mbn.authlibinjector.config");
if (!configProperty.startsWith("@")) {
if (configProperty == null || !configProperty.startsWith("@")) {
return empty();
}
String url = configProperty.substring(1);

View file

@ -13,11 +13,12 @@ import org.to2mbn.authlibinjector.transform.YggdrasilKeyTransformUnit;
public class InjectorConfig {
private static byte[] decodePublicKey(String input) {
final String header = "-----BEGIN PUBLIC KEY-----\n";
input = input.replace("\n", "");
final String header = "-----BEGIN PUBLIC KEY-----";
final String end = "-----END PUBLIC KEY-----";
if (input.startsWith(header) && input.endsWith(end)) {
return Base64.getDecoder()
.decode(input.substring(header.length(), input.length() - end.length()).replace("\n", ""));
.decode(input.substring(header.length(), input.length() - end.length()));
} else {
throw new IllegalArgumentException("Bad key format");
}