Force encryption to be used when it is enabled.

Not doing this check would make it possible to skip encryption when it is enabled.
This commit is contained in:
Mike 2020-05-02 04:36:26 +02:00
parent 208be6210c
commit 57f66a1514
3 changed files with 15 additions and 0 deletions

View File

@ -24,6 +24,7 @@ public class GameClient {
private final HabboEncryption encryption;
private Habbo habbo;
private boolean handshakeFinished;
private String machineId = "";
public final ConcurrentHashMap<Integer, Integer> incomingPacketCounter = new ConcurrentHashMap<>(25);
@ -56,6 +57,14 @@ public class GameClient {
this.habbo = habbo;
}
public boolean isHandshakeFinished() {
return handshakeFinished;
}
public void setHandshakeFinished(boolean handshakeFinished) {
this.handshakeFinished = handshakeFinished;
}
public String getMachineId() {
return this.machineId;
}

View File

@ -21,6 +21,7 @@ public class CompleteDiffieHandshakeEvent extends MessageHandler {
byte[] sharedKey = this.client.getEncryption().getDiffie().getSharedKey(this.packet.readString());
this.client.setHandshakeFinished(true);
this.client.sendResponse(new CompleteDiffieHandshakeComposer(this.client.getEncryption().getDiffie().getPublicKey()));
this.client.getChannel().attr(GameServerAttributes.CRYPTO_CLIENT).set(new HabboRC4(sharedKey));

View File

@ -51,6 +51,11 @@ public class SecureLoginEvent extends MessageHandler {
if (!Emulator.isReady)
return;
if (Emulator.getCrypto().isEnabled() && !this.client.isHandshakeFinished()) {
Emulator.getGameServer().getGameClientManager().disposeClient(this.client);
return;
}
String sso = this.packet.readString().replace(" ", "");
if (Emulator.getPluginManager().fireEvent(new SSOAuthenticationEvent(sso)).isCancelled()) {