Java 类net.minecraft.network.login.client.C01PacketEncryptionResponse 实例源码

项目:Cauldron    文件:NetHandlerLoginServer.java   
public void processEncryptionResponse(C01PacketEncryptionResponse p_147315_1_)
{
    Validate.validState(this.field_147328_g == LoginState.KEY, "Unexpected key packet", new Object[0]);
    PrivateKey privatekey = this.field_147327_f.getKeyPair().getPrivate();

    if (!Arrays.equals(this.field_147330_e, p_147315_1_.func_149299_b(privatekey)))
    {
        throw new IllegalStateException("Invalid nonce!");
    }
    else
    {
        this.field_147335_k = p_147315_1_.func_149300_a(privatekey);
        this.field_147328_g = NetHandlerLoginServer.LoginState.AUTHENTICATING;
        this.field_147333_a.enableEncryption(this.field_147335_k);
        (new ThreadPlayerLookupUUID(this, "User Authenticator #" + field_147331_b.incrementAndGet())).start();
    }
}
项目:Resilience-Client-Source    文件:NetHandlerLoginClient.java   
public void handleEncryptionRequest(S01PacketEncryptionRequest p_147389_1_)
{
    final SecretKey var2 = CryptManager.createNewSharedKey();
    String var3 = p_147389_1_.func_149609_c();
    PublicKey var4 = p_147389_1_.func_149608_d();
    String var5 = (new BigInteger(CryptManager.getServerIdHash(var3, var4, var2))).toString(16);

    try
    {
        this.func_147391_c().joinServer(this.field_147394_b.getSession().func_148256_e(), this.field_147394_b.getSession().getToken(), var5);
    }
    catch (AuthenticationUnavailableException var7)
    {
        this.field_147393_d.closeChannel(new ChatComponentTranslation("disconnect.loginFailedInfo", new Object[] {new ChatComponentTranslation("disconnect.loginFailedInfo.serversUnavailable", new Object[0])}));
        return;
    }
    catch (InvalidCredentialsException var8)
    {
        this.field_147393_d.closeChannel(new ChatComponentTranslation("disconnect.loginFailedInfo", new Object[] {new ChatComponentTranslation("disconnect.loginFailedInfo.invalidSession", new Object[0])}));
        return;
    }
    catch (AuthenticationException var9)
    {
        this.field_147393_d.closeChannel(new ChatComponentTranslation("disconnect.loginFailedInfo", new Object[] {var9.getMessage()}));
        return;
    }

    this.field_147393_d.scheduleOutboundPacket(new C01PacketEncryptionResponse(var2, var4, p_147389_1_.func_149607_e()), new GenericFutureListener[] {new GenericFutureListener()
        {
            private static final String __OBFID = "CL_00000877";
            public void operationComplete(Future p_operationComplete_1_)
            {
                NetHandlerLoginClient.this.field_147393_d.enableEncryption(var2);
            }
        }
    });
}
项目:DecompiledMinecraft    文件:NetHandlerLoginServer.java   
public void processEncryptionResponse(C01PacketEncryptionResponse packetIn)
{
    Validate.validState(this.currentLoginState == NetHandlerLoginServer.LoginState.KEY, "Unexpected key packet", new Object[0]);
    PrivateKey privatekey = this.server.getKeyPair().getPrivate();

    if (!Arrays.equals(this.verifyToken, packetIn.getVerifyToken(privatekey)))
    {
        throw new IllegalStateException("Invalid nonce!");
    }
    else
    {
        this.secretKey = packetIn.getSecretKey(privatekey);
        this.currentLoginState = NetHandlerLoginServer.LoginState.AUTHENTICATING;
        this.networkManager.enableEncryption(this.secretKey);
        (new Thread("User Authenticator #" + AUTHENTICATOR_THREAD_ID.incrementAndGet())
        {
            public void run()
            {
                GameProfile gameprofile = NetHandlerLoginServer.this.loginGameProfile;

                try
                {
                    String s = (new BigInteger(CryptManager.getServerIdHash(NetHandlerLoginServer.this.serverId, NetHandlerLoginServer.this.server.getKeyPair().getPublic(), NetHandlerLoginServer.this.secretKey))).toString(16);
                    NetHandlerLoginServer.this.loginGameProfile = NetHandlerLoginServer.this.server.getMinecraftSessionService().hasJoinedServer(new GameProfile((UUID)null, gameprofile.getName()), s);

                    if (NetHandlerLoginServer.this.loginGameProfile != null)
                    {
                        NetHandlerLoginServer.logger.info("UUID of player " + NetHandlerLoginServer.this.loginGameProfile.getName() + " is " + NetHandlerLoginServer.this.loginGameProfile.getId());
                        NetHandlerLoginServer.this.currentLoginState = NetHandlerLoginServer.LoginState.READY_TO_ACCEPT;
                    }
                    else if (NetHandlerLoginServer.this.server.isSinglePlayer())
                    {
                        NetHandlerLoginServer.logger.warn("Failed to verify username but will let them in anyway!");
                        NetHandlerLoginServer.this.loginGameProfile = NetHandlerLoginServer.this.getOfflineProfile(gameprofile);
                        NetHandlerLoginServer.this.currentLoginState = NetHandlerLoginServer.LoginState.READY_TO_ACCEPT;
                    }
                    else
                    {
                        NetHandlerLoginServer.this.closeConnection("Failed to verify username!");
                        NetHandlerLoginServer.logger.error("Username \'" + NetHandlerLoginServer.this.loginGameProfile.getName() + "\' tried to join with an invalid session");
                    }
                }
                catch (AuthenticationUnavailableException var3)
                {
                    if (NetHandlerLoginServer.this.server.isSinglePlayer())
                    {
                        NetHandlerLoginServer.logger.warn("Authentication servers are down but will let them in anyway!");
                        NetHandlerLoginServer.this.loginGameProfile = NetHandlerLoginServer.this.getOfflineProfile(gameprofile);
                        NetHandlerLoginServer.this.currentLoginState = NetHandlerLoginServer.LoginState.READY_TO_ACCEPT;
                    }
                    else
                    {
                        NetHandlerLoginServer.this.closeConnection("Authentication servers are down. Please try again later, sorry!");
                        NetHandlerLoginServer.logger.error("Couldn\'t verify username because servers are unavailable");
                    }
                }
            }
        }).start();
    }
}
项目:DecompiledMinecraft    文件:NetHandlerLoginClient.java   
public void handleEncryptionRequest(S01PacketEncryptionRequest 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().func_181041_d())
    {
        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 ChatComponentTranslation("disconnect.loginFailedInfo", new Object[] {new ChatComponentTranslation("disconnect.loginFailedInfo.serversUnavailable", new Object[0])}));
            return;
        }
        catch (InvalidCredentialsException var8)
        {
            this.networkManager.closeChannel(new ChatComponentTranslation("disconnect.loginFailedInfo", new Object[] {new ChatComponentTranslation("disconnect.loginFailedInfo.invalidSession", new Object[0])}));
            return;
        }
        catch (AuthenticationException authenticationexception)
        {
            this.networkManager.closeChannel(new ChatComponentTranslation("disconnect.loginFailedInfo", new Object[] {authenticationexception.getMessage()}));
            return;
        }
    }

    this.networkManager.sendPacket(new C01PacketEncryptionResponse(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]);
}
项目:DecompiledMinecraft    文件:NetHandlerLoginServer.java   
public void processEncryptionResponse(C01PacketEncryptionResponse packetIn)
{
    Validate.validState(this.currentLoginState == NetHandlerLoginServer.LoginState.KEY, "Unexpected key packet", new Object[0]);
    PrivateKey privatekey = this.server.getKeyPair().getPrivate();

    if (!Arrays.equals(this.verifyToken, packetIn.getVerifyToken(privatekey)))
    {
        throw new IllegalStateException("Invalid nonce!");
    }
    else
    {
        this.secretKey = packetIn.getSecretKey(privatekey);
        this.currentLoginState = NetHandlerLoginServer.LoginState.AUTHENTICATING;
        this.networkManager.enableEncryption(this.secretKey);
        (new Thread("User Authenticator #" + AUTHENTICATOR_THREAD_ID.incrementAndGet())
        {
            public void run()
            {
                GameProfile gameprofile = NetHandlerLoginServer.this.loginGameProfile;

                try
                {
                    String s = (new BigInteger(CryptManager.getServerIdHash(NetHandlerLoginServer.this.serverId, NetHandlerLoginServer.this.server.getKeyPair().getPublic(), NetHandlerLoginServer.this.secretKey))).toString(16);
                    NetHandlerLoginServer.this.loginGameProfile = NetHandlerLoginServer.this.server.getMinecraftSessionService().hasJoinedServer(new GameProfile((UUID)null, gameprofile.getName()), s);

                    if (NetHandlerLoginServer.this.loginGameProfile != null)
                    {
                        NetHandlerLoginServer.logger.info("UUID of player " + NetHandlerLoginServer.this.loginGameProfile.getName() + " is " + NetHandlerLoginServer.this.loginGameProfile.getId());
                        NetHandlerLoginServer.this.currentLoginState = NetHandlerLoginServer.LoginState.READY_TO_ACCEPT;
                    }
                    else if (NetHandlerLoginServer.this.server.isSinglePlayer())
                    {
                        NetHandlerLoginServer.logger.warn("Failed to verify username but will let them in anyway!");
                        NetHandlerLoginServer.this.loginGameProfile = NetHandlerLoginServer.this.getOfflineProfile(gameprofile);
                        NetHandlerLoginServer.this.currentLoginState = NetHandlerLoginServer.LoginState.READY_TO_ACCEPT;
                    }
                    else
                    {
                        NetHandlerLoginServer.this.closeConnection("Failed to verify username!");
                        NetHandlerLoginServer.logger.error("Username \'" + NetHandlerLoginServer.this.loginGameProfile.getName() + "\' tried to join with an invalid session");
                    }
                }
                catch (AuthenticationUnavailableException var3)
                {
                    if (NetHandlerLoginServer.this.server.isSinglePlayer())
                    {
                        NetHandlerLoginServer.logger.warn("Authentication servers are down but will let them in anyway!");
                        NetHandlerLoginServer.this.loginGameProfile = NetHandlerLoginServer.this.getOfflineProfile(gameprofile);
                        NetHandlerLoginServer.this.currentLoginState = NetHandlerLoginServer.LoginState.READY_TO_ACCEPT;
                    }
                    else
                    {
                        NetHandlerLoginServer.this.closeConnection("Authentication servers are down. Please try again later, sorry!");
                        NetHandlerLoginServer.logger.error("Couldn\'t verify username because servers are unavailable");
                    }
                }
            }
        }).start();
    }
}
项目:BaseClient    文件:NetHandlerLoginClient.java   
public void handleEncryptionRequest(S01PacketEncryptionRequest 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().func_181041_d())
    {
        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 ChatComponentTranslation("disconnect.loginFailedInfo", new Object[] {new ChatComponentTranslation("disconnect.loginFailedInfo.serversUnavailable", new Object[0])}));
            return;
        }
        catch (InvalidCredentialsException var8)
        {
            this.networkManager.closeChannel(new ChatComponentTranslation("disconnect.loginFailedInfo", new Object[] {new ChatComponentTranslation("disconnect.loginFailedInfo.invalidSession", new Object[0])}));
            return;
        }
        catch (AuthenticationException authenticationexception)
        {
            this.networkManager.closeChannel(new ChatComponentTranslation("disconnect.loginFailedInfo", new Object[] {authenticationexception.getMessage()}));
            return;
        }
    }

    this.networkManager.sendPacket(new C01PacketEncryptionResponse(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]);
}
项目:BaseClient    文件:NetHandlerLoginServer.java   
public void processEncryptionResponse(C01PacketEncryptionResponse packetIn)
{
    Validate.validState(this.currentLoginState == NetHandlerLoginServer.LoginState.KEY, "Unexpected key packet", new Object[0]);
    PrivateKey privatekey = this.server.getKeyPair().getPrivate();

    if (!Arrays.equals(this.verifyToken, packetIn.getVerifyToken(privatekey)))
    {
        throw new IllegalStateException("Invalid nonce!");
    }
    else
    {
        this.secretKey = packetIn.getSecretKey(privatekey);
        this.currentLoginState = NetHandlerLoginServer.LoginState.AUTHENTICATING;
        this.networkManager.enableEncryption(this.secretKey);
        (new Thread("User Authenticator #" + AUTHENTICATOR_THREAD_ID.incrementAndGet())
        {
            public void run()
            {
                GameProfile gameprofile = NetHandlerLoginServer.this.loginGameProfile;

                try
                {
                    String s = (new BigInteger(CryptManager.getServerIdHash(NetHandlerLoginServer.this.serverId, NetHandlerLoginServer.this.server.getKeyPair().getPublic(), NetHandlerLoginServer.this.secretKey))).toString(16);
                    NetHandlerLoginServer.this.loginGameProfile = NetHandlerLoginServer.this.server.getMinecraftSessionService().hasJoinedServer(new GameProfile((UUID)null, gameprofile.getName()), s);

                    if (NetHandlerLoginServer.this.loginGameProfile != null)
                    {
                        NetHandlerLoginServer.logger.info("UUID of player " + NetHandlerLoginServer.this.loginGameProfile.getName() + " is " + NetHandlerLoginServer.this.loginGameProfile.getId());
                        NetHandlerLoginServer.this.currentLoginState = NetHandlerLoginServer.LoginState.READY_TO_ACCEPT;
                    }
                    else if (NetHandlerLoginServer.this.server.isSinglePlayer())
                    {
                        NetHandlerLoginServer.logger.warn("Failed to verify username but will let them in anyway!");
                        NetHandlerLoginServer.this.loginGameProfile = NetHandlerLoginServer.this.getOfflineProfile(gameprofile);
                        NetHandlerLoginServer.this.currentLoginState = NetHandlerLoginServer.LoginState.READY_TO_ACCEPT;
                    }
                    else
                    {
                        NetHandlerLoginServer.this.closeConnection("Failed to verify username!");
                        NetHandlerLoginServer.logger.error("Username \'" + NetHandlerLoginServer.this.loginGameProfile.getName() + "\' tried to join with an invalid session");
                    }
                }
                catch (AuthenticationUnavailableException var3)
                {
                    if (NetHandlerLoginServer.this.server.isSinglePlayer())
                    {
                        NetHandlerLoginServer.logger.warn("Authentication servers are down but will let them in anyway!");
                        NetHandlerLoginServer.this.loginGameProfile = NetHandlerLoginServer.this.getOfflineProfile(gameprofile);
                        NetHandlerLoginServer.this.currentLoginState = NetHandlerLoginServer.LoginState.READY_TO_ACCEPT;
                    }
                    else
                    {
                        NetHandlerLoginServer.this.closeConnection("Authentication servers are down. Please try again later, sorry!");
                        NetHandlerLoginServer.logger.error("Couldn\'t verify username because servers are unavailable");
                    }
                }
            }
        }).start();
    }
}
项目:BaseClient    文件:NetHandlerLoginClient.java   
public void handleEncryptionRequest(S01PacketEncryptionRequest 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().func_181041_d())
    {
        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 ChatComponentTranslation("disconnect.loginFailedInfo", new Object[] {new ChatComponentTranslation("disconnect.loginFailedInfo.serversUnavailable", new Object[0])}));
            return;
        }
        catch (InvalidCredentialsException var8)
        {
            this.networkManager.closeChannel(new ChatComponentTranslation("disconnect.loginFailedInfo", new Object[] {new ChatComponentTranslation("disconnect.loginFailedInfo.invalidSession", new Object[0])}));
            return;
        }
        catch (AuthenticationException authenticationexception)
        {
            this.networkManager.closeChannel(new ChatComponentTranslation("disconnect.loginFailedInfo", new Object[] {authenticationexception.getMessage()}));
            return;
        }
    }

    this.networkManager.sendPacket(new C01PacketEncryptionResponse(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]);
}
项目:BaseClient    文件:NetHandlerLoginServer.java   
public void processEncryptionResponse(C01PacketEncryptionResponse packetIn)
{
    Validate.validState(this.currentLoginState == NetHandlerLoginServer.LoginState.KEY, "Unexpected key packet", new Object[0]);
    PrivateKey privatekey = this.server.getKeyPair().getPrivate();

    if (!Arrays.equals(this.verifyToken, packetIn.getVerifyToken(privatekey)))
    {
        throw new IllegalStateException("Invalid nonce!");
    }
    else
    {
        this.secretKey = packetIn.getSecretKey(privatekey);
        this.currentLoginState = NetHandlerLoginServer.LoginState.AUTHENTICATING;
        this.networkManager.enableEncryption(this.secretKey);
        (new Thread("User Authenticator #" + AUTHENTICATOR_THREAD_ID.incrementAndGet())
        {
            public void run()
            {
                GameProfile gameprofile = NetHandlerLoginServer.this.loginGameProfile;

                try
                {
                    String s = (new BigInteger(CryptManager.getServerIdHash(NetHandlerLoginServer.this.serverId, NetHandlerLoginServer.this.server.getKeyPair().getPublic(), NetHandlerLoginServer.this.secretKey))).toString(16);
                    NetHandlerLoginServer.this.loginGameProfile = NetHandlerLoginServer.this.server.getMinecraftSessionService().hasJoinedServer(new GameProfile((UUID)null, gameprofile.getName()), s);

                    if (NetHandlerLoginServer.this.loginGameProfile != null)
                    {
                        NetHandlerLoginServer.logger.info("UUID of player " + NetHandlerLoginServer.this.loginGameProfile.getName() + " is " + NetHandlerLoginServer.this.loginGameProfile.getId());
                        NetHandlerLoginServer.this.currentLoginState = NetHandlerLoginServer.LoginState.READY_TO_ACCEPT;
                    }
                    else if (NetHandlerLoginServer.this.server.isSinglePlayer())
                    {
                        NetHandlerLoginServer.logger.warn("Failed to verify username but will let them in anyway!");
                        NetHandlerLoginServer.this.loginGameProfile = NetHandlerLoginServer.this.getOfflineProfile(gameprofile);
                        NetHandlerLoginServer.this.currentLoginState = NetHandlerLoginServer.LoginState.READY_TO_ACCEPT;
                    }
                    else
                    {
                        NetHandlerLoginServer.this.closeConnection("Failed to verify username!");
                        NetHandlerLoginServer.logger.error("Username \'" + NetHandlerLoginServer.this.loginGameProfile.getName() + "\' tried to join with an invalid session");
                    }
                }
                catch (AuthenticationUnavailableException var3)
                {
                    if (NetHandlerLoginServer.this.server.isSinglePlayer())
                    {
                        NetHandlerLoginServer.logger.warn("Authentication servers are down but will let them in anyway!");
                        NetHandlerLoginServer.this.loginGameProfile = NetHandlerLoginServer.this.getOfflineProfile(gameprofile);
                        NetHandlerLoginServer.this.currentLoginState = NetHandlerLoginServer.LoginState.READY_TO_ACCEPT;
                    }
                    else
                    {
                        NetHandlerLoginServer.this.closeConnection("Authentication servers are down. Please try again later, sorry!");
                        NetHandlerLoginServer.logger.error("Couldn\'t verify username because servers are unavailable");
                    }
                }
            }
        }).start();
    }
}
项目:Cauldron    文件:NetHandlerLoginClient.java   
public void handleEncryptionRequest(S01PacketEncryptionRequest p_147389_1_)
{
    final SecretKey secretkey = CryptManager.createNewSharedKey();
    String s = p_147389_1_.func_149609_c();
    PublicKey publickey = p_147389_1_.func_149608_d();
    String s1 = (new BigInteger(CryptManager.getServerIdHash(s, publickey, secretkey))).toString(16);
    boolean flag = this.field_147394_b.func_147104_D() == null || !this.field_147394_b.func_147104_D().func_152585_d();

    try
    {
        this.func_147391_c().joinServer(this.field_147394_b.getSession().func_148256_e(), this.field_147394_b.getSession().getToken(), s1);
    }
    catch (AuthenticationUnavailableException authenticationunavailableexception)
    {
        if (flag)
        {
            this.field_147393_d.closeChannel(new ChatComponentTranslation("disconnect.loginFailedInfo", new Object[] {new ChatComponentTranslation("disconnect.loginFailedInfo.serversUnavailable", new Object[0])}));
            return;
        }
    }
    catch (InvalidCredentialsException invalidcredentialsexception)
    {
        if (flag)
        {
            this.field_147393_d.closeChannel(new ChatComponentTranslation("disconnect.loginFailedInfo", new Object[] {new ChatComponentTranslation("disconnect.loginFailedInfo.invalidSession", new Object[0])}));
            return;
        }
    }
    catch (AuthenticationException authenticationexception)
    {
        if (flag)
        {
            this.field_147393_d.closeChannel(new ChatComponentTranslation("disconnect.loginFailedInfo", new Object[] {authenticationexception.getMessage()}));
            return;
        }
    }

    this.field_147393_d.scheduleOutboundPacket(new C01PacketEncryptionResponse(secretkey, publickey, p_147389_1_.func_149607_e()), new GenericFutureListener[] {new GenericFutureListener()
    {
        private static final String __OBFID = "CL_00000877";
        public void operationComplete(Future p_operationComplete_1_)
        {
            NetHandlerLoginClient.this.field_147393_d.enableEncryption(secretkey);
        }
    }
                                                                                                                                            });
}
项目:Cauldron    文件:NetHandlerLoginClient.java   
public void handleEncryptionRequest(S01PacketEncryptionRequest p_147389_1_)
{
    final SecretKey secretkey = CryptManager.createNewSharedKey();
    String s = p_147389_1_.func_149609_c();
    PublicKey publickey = p_147389_1_.func_149608_d();
    String s1 = (new BigInteger(CryptManager.getServerIdHash(s, publickey, secretkey))).toString(16);
    boolean flag = this.field_147394_b.func_147104_D() == null || !this.field_147394_b.func_147104_D().func_152585_d();

    try
    {
        this.func_147391_c().joinServer(this.field_147394_b.getSession().func_148256_e(), this.field_147394_b.getSession().getToken(), s1);
    }
    catch (AuthenticationUnavailableException authenticationunavailableexception)
    {
        if (flag)
        {
            this.field_147393_d.closeChannel(new ChatComponentTranslation("disconnect.loginFailedInfo", new Object[] {new ChatComponentTranslation("disconnect.loginFailedInfo.serversUnavailable", new Object[0])}));
            return;
        }
    }
    catch (InvalidCredentialsException invalidcredentialsexception)
    {
        if (flag)
        {
            this.field_147393_d.closeChannel(new ChatComponentTranslation("disconnect.loginFailedInfo", new Object[] {new ChatComponentTranslation("disconnect.loginFailedInfo.invalidSession", new Object[0])}));
            return;
        }
    }
    catch (AuthenticationException authenticationexception)
    {
        if (flag)
        {
            this.field_147393_d.closeChannel(new ChatComponentTranslation("disconnect.loginFailedInfo", new Object[] {authenticationexception.getMessage()}));
            return;
        }
    }

    this.field_147393_d.scheduleOutboundPacket(new C01PacketEncryptionResponse(secretkey, publickey, p_147389_1_.func_149607_e()), new GenericFutureListener[] {new GenericFutureListener()
    {
        private static final String __OBFID = "CL_00000877";
        public void operationComplete(Future p_operationComplete_1_)
        {
            NetHandlerLoginClient.this.field_147393_d.enableEncryption(secretkey);
        }
    }
                                                                                                                                            });
}
项目:Cauldron    文件:NetHandlerLoginServer.java   
public void processEncryptionResponse(C01PacketEncryptionResponse p_147315_1_)
{
    Validate.validState(this.field_147328_g == NetHandlerLoginServer.LoginState.KEY, "Unexpected key packet", new Object[0]);
    PrivateKey privatekey = this.field_147327_f.getKeyPair().getPrivate();

    if (!Arrays.equals(this.field_147330_e, p_147315_1_.func_149299_b(privatekey)))
    {
        throw new IllegalStateException("Invalid nonce!");
    }
    else
    {
        this.field_147335_k = p_147315_1_.func_149300_a(privatekey);
        this.field_147328_g = NetHandlerLoginServer.LoginState.AUTHENTICATING;
        this.field_147333_a.enableEncryption(this.field_147335_k);
        (new Thread("User Authenticator #" + field_147331_b.incrementAndGet())
        {
            private static final String __OBFID = "CL_00001459";
            public void run()
            {
                GameProfile gameprofile = NetHandlerLoginServer.this.field_147337_i;

                try
                {
                    String s = (new BigInteger(CryptManager.getServerIdHash(NetHandlerLoginServer.this.field_147334_j, NetHandlerLoginServer.this.field_147327_f.getKeyPair().getPublic(), NetHandlerLoginServer.this.field_147335_k))).toString(16);
                    NetHandlerLoginServer.this.field_147337_i = NetHandlerLoginServer.this.field_147327_f.func_147130_as().hasJoinedServer(new GameProfile((UUID)null, gameprofile.getName()), s);

                    if (NetHandlerLoginServer.this.field_147337_i != null)
                    {
                        NetHandlerLoginServer.logger.info("UUID of player " + NetHandlerLoginServer.this.field_147337_i.getName() + " is " + NetHandlerLoginServer.this.field_147337_i.getId());
                        NetHandlerLoginServer.this.field_147328_g = NetHandlerLoginServer.LoginState.READY_TO_ACCEPT;
                    }
                    else if (NetHandlerLoginServer.this.field_147327_f.isSinglePlayer())
                    {
                        NetHandlerLoginServer.logger.warn("Failed to verify username but will let them in anyway!");
                        NetHandlerLoginServer.this.field_147337_i = NetHandlerLoginServer.this.func_152506_a(gameprofile);
                        NetHandlerLoginServer.this.field_147328_g = NetHandlerLoginServer.LoginState.READY_TO_ACCEPT;
                    }
                    else
                    {
                        NetHandlerLoginServer.this.func_147322_a("Failed to verify username!");
                        NetHandlerLoginServer.logger.error("Username \'" + NetHandlerLoginServer.this.field_147337_i.getName() + "\' tried to join with an invalid session");
                    }
                }
                catch (AuthenticationUnavailableException authenticationunavailableexception)
                {
                    if (NetHandlerLoginServer.this.field_147327_f.isSinglePlayer())
                    {
                        NetHandlerLoginServer.logger.warn("Authentication servers are down but will let them in anyway!");
                        NetHandlerLoginServer.this.field_147337_i = NetHandlerLoginServer.this.func_152506_a(gameprofile);
                        NetHandlerLoginServer.this.field_147328_g = NetHandlerLoginServer.LoginState.READY_TO_ACCEPT;
                    }
                    else
                    {
                        NetHandlerLoginServer.this.func_147322_a("Authentication servers are down. Please try again later, sorry!");
                        NetHandlerLoginServer.logger.error("Couldn\'t verify username because servers are unavailable");
                    }
                }
            }
        }).start();
    }
}
项目:DecompiledMinecraft    文件:INetHandlerLoginServer.java   
void processEncryptionResponse(C01PacketEncryptionResponse packetIn);
项目:DecompiledMinecraft    文件:INetHandlerLoginServer.java   
void processEncryptionResponse(C01PacketEncryptionResponse packetIn);
项目:BaseClient    文件:INetHandlerLoginServer.java   
void processEncryptionResponse(C01PacketEncryptionResponse packetIn);
项目:BaseClient    文件:INetHandlerLoginServer.java   
void processEncryptionResponse(C01PacketEncryptionResponse packetIn);
项目:Resilience-Client-Source    文件:INetHandlerLoginServer.java   
void processEncryptionResponse(C01PacketEncryptionResponse var1);
项目:Cauldron    文件:INetHandlerLoginServer.java   
void processEncryptionResponse(C01PacketEncryptionResponse p_147315_1_);
项目:Cauldron    文件:INetHandlerLoginServer.java   
void processEncryptionResponse(C01PacketEncryptionResponse p_147315_1_);