Skip to content

Commit 9175072

Browse files
committed
Fix encryption issues in Java 8u231
1 parent 5b40eec commit 9175072

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

bedrock/bedrock-common/src/main/java/com/nukkitx/protocol/bedrock/util/EncryptionUtils.java

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,11 @@ public class EncryptionUtils {
4040
private static final KeyPairGenerator KEY_PAIR_GEN;
4141

4242
static {
43+
// DO NOT REMOVE THIS
44+
// Since Java 8u231, secp384r1 is deprecated and will throw an exception.
45+
String namedGroups = System.getProperty("jdk.tls.namedGroups");
46+
System.setProperty("jdk.tls.namedGroups", namedGroups.isEmpty() ? "secp384r1" : ", secp384r1");
47+
4348
try {
4449
KEY_PAIR_GEN = KeyPairGenerator.getInstance("EC");
4550
KEY_PAIR_GEN.initialize(new ECGenParameterSpec("secp384r1"));

0 commit comments

Comments
 (0)