Skip to content

Commit

Permalink
0.4.1 decrypt exception handle
Browse files Browse the repository at this point in the history
  • Loading branch information
Immueggpain authored and Immueggpain committed Dec 5, 2019
1 parent bf77eee commit 274fde4
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 3 deletions.
2 changes: 1 addition & 1 deletion pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@

<groupId>com.github.immueggpain</groupId>
<artifactId>bettermultiplayer</artifactId>
<version>0.4.0</version>
<version>0.4.1</version>

<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
import java.net.InetAddress;
import java.nio.charset.Charset;
import java.nio.charset.StandardCharsets;
import java.security.GeneralSecurityException;
import java.util.concurrent.Callable;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
Expand Down Expand Up @@ -140,7 +141,14 @@ private void recv_server_thread(int local_ovpn_port) {
p.setData(recvBuf);
socketServer.receive(p);

byte[] decrypted = Util.decrypt(decrypter, secretKey, p.getData(), p.getOffset(), p.getLength());
byte[] decrypted;
try {
decrypted = Util.decrypt(decrypter, secretKey, p.getData(), p.getOffset(), p.getLength());
} catch (GeneralSecurityException e) {
System.err.println(e);
System.err.println("decrypt failed, skip this packet!");
continue;
}

p.setData(decrypted);
p.setAddress(loopback_addr);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
version = Launcher.VERSTR, subcommands = { HelpCommand.class, BMPUDPHub.class, BMPPeer.class })
public class Launcher implements Callable<Void> {

public static final String VERSTR = "0.4.0";
public static final String VERSTR = "0.4.1";
public static final int LOCAL_PORT = 2233;
public static final int LOCAL_OVPN_PORT = 1194;

Expand Down

0 comments on commit 274fde4

Please sign in to comment.