/** * Hook for EncryptionRequestEvent * * @see EncryptionRequestEvent */ @Inject(method = "handleEncryptionRequest", at = @At("HEAD"), cancellable = true) private void onLoginEncryptionRequest(SPacketEncryptionRequest packet, CallbackInfo ci) { EncryptionRequestEvent event = new EncryptionRequestEvent((NetHandlerLoginClient) (Object) this, packet); EVENT_BUS.post(event); if (event.isCancelled()) ci.cancel(); }
public void processLoginStart(CPacketLoginStart packetIn) { Validate.validState(this.currentLoginState == NetHandlerLoginServer.LoginState.HELLO, "Unexpected hello packet", new Object[0]); this.loginGameProfile = packetIn.getProfile(); if (this.server.isServerInOnlineMode() && !this.networkManager.isLocalChannel()) { this.currentLoginState = NetHandlerLoginServer.LoginState.KEY; this.networkManager.sendPacket(new SPacketEncryptionRequest("", this.server.getKeyPair().getPublic(), this.verifyToken)); } else { this.currentLoginState = NetHandlerLoginServer.LoginState.READY_TO_ACCEPT; } }
/** * @param hetHandler the NetHandlerLoginClient object that received the request * @param packet the encryption request packet */ public EncryptionRequestEvent(NetHandlerLoginClient hetHandler, SPacketEncryptionRequest packet) { this.net = hetHandler; this.packet = packet; }
/** * @return the encryption request packet */ public SPacketEncryptionRequest getPacket() { return packet; }
public void handleEncryptionRequest(SPacketEncryptionRequest packetIn) { final SecretKey secretkey = CryptManager.createNewSharedKey(); String s = packetIn.getServerId(); PublicKey publickey = packetIn.getPublicKey(); String s1 = (new BigInteger(CryptManager.getServerIdHash(s, publickey, secretkey))).toString(16); if (this.mc.getCurrentServerData() != null && this.mc.getCurrentServerData().isOnLAN()) { try { this.getSessionService().joinServer(this.mc.getSession().getProfile(), this.mc.getSession().getToken(), s1); } catch (AuthenticationException var10) { LOGGER.warn("Couldn\'t connect to auth servers but will continue to join LAN"); } } else { try { this.getSessionService().joinServer(this.mc.getSession().getProfile(), this.mc.getSession().getToken(), s1); } catch (AuthenticationUnavailableException var7) { this.networkManager.closeChannel(new TextComponentTranslation("disconnect.loginFailedInfo", new Object[] {new TextComponentTranslation("disconnect.loginFailedInfo.serversUnavailable", new Object[0])})); return; } catch (InvalidCredentialsException var8) { this.networkManager.closeChannel(new TextComponentTranslation("disconnect.loginFailedInfo", new Object[] {new TextComponentTranslation("disconnect.loginFailedInfo.invalidSession", new Object[0])})); return; } catch (AuthenticationException authenticationexception) { this.networkManager.closeChannel(new TextComponentTranslation("disconnect.loginFailedInfo", new Object[] {authenticationexception.getMessage()})); return; } } this.networkManager.sendPacket(new CPacketEncryptionResponse(secretkey, publickey, packetIn.getVerifyToken()), new GenericFutureListener < Future <? super Void >> () { public void operationComplete(Future <? super Void > p_operationComplete_1_) throws Exception { NetHandlerLoginClient.this.networkManager.enableEncryption(secretkey); } }, new GenericFutureListener[0]); }
void handleEncryptionRequest(SPacketEncryptionRequest packetIn);