Loginserver improvements.
This commit is contained in:
@@ -17,6 +17,7 @@
|
||||
package com.l2jmobius.commons.util.crypt;
|
||||
|
||||
import java.math.BigInteger;
|
||||
import java.security.Key;
|
||||
import java.security.KeyPair;
|
||||
import java.security.interfaces.RSAPublicKey;
|
||||
import java.util.logging.Logger;
|
||||
@@ -74,4 +75,14 @@ public class ScrambledKeyPair
|
||||
{
|
||||
return _scrambledModulus;
|
||||
}
|
||||
|
||||
public Key getPrivateKey()
|
||||
{
|
||||
return _pair.getPrivate();
|
||||
}
|
||||
|
||||
public Key getPublicKey()
|
||||
{
|
||||
return _pair.getPublic();
|
||||
}
|
||||
}
|
||||
|
@@ -21,7 +21,6 @@ import java.io.IOException;
|
||||
import java.io.InputStream;
|
||||
import java.io.OutputStream;
|
||||
import java.net.Socket;
|
||||
import java.security.KeyPair;
|
||||
import java.security.interfaces.RSAPrivateKey;
|
||||
import java.security.interfaces.RSAPublicKey;
|
||||
import java.util.Set;
|
||||
@@ -29,6 +28,7 @@ import java.util.concurrent.ConcurrentHashMap;
|
||||
import java.util.logging.Logger;
|
||||
|
||||
import com.l2jmobius.commons.util.crypt.NewCrypt;
|
||||
import com.l2jmobius.commons.util.crypt.ScrambledKeyPair;
|
||||
import com.l2jmobius.commons.util.network.BaseSendablePacket;
|
||||
import com.l2jmobius.loginserver.GameServerTable.GameServerInfo;
|
||||
import com.l2jmobius.loginserver.network.L2JGameServerPacketHandler;
|
||||
@@ -211,9 +211,9 @@ public class GameServerThread extends Thread
|
||||
{
|
||||
_log.warning(getClass().getSimpleName() + ": " + e.getMessage());
|
||||
}
|
||||
final KeyPair pair = GameServerTable.getInstance().getKeyPair();
|
||||
_privateKey = (RSAPrivateKey) pair.getPrivate();
|
||||
_publicKey = (RSAPublicKey) pair.getPublic();
|
||||
final ScrambledKeyPair pair = LoginController.getInstance().getScrambledRSAKeyPair();
|
||||
_privateKey = (RSAPrivateKey) pair.getPrivateKey();
|
||||
_publicKey = (RSAPublicKey) pair.getPublicKey();
|
||||
_blowfish = new NewCrypt("_;v.]05-31!|+-%xT!^[$\00");
|
||||
setName(getClass().getSimpleName() + "-" + getId() + "@" + _connectionIp);
|
||||
start();
|
||||
|
@@ -18,7 +18,6 @@ package com.l2jmobius.loginserver.network;
|
||||
|
||||
import java.net.InetAddress;
|
||||
import java.net.InetSocketAddress;
|
||||
import java.security.interfaces.RSAPrivateKey;
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
import java.util.logging.Logger;
|
||||
@@ -69,8 +68,8 @@ public final class L2LoginClient extends ChannelInboundHandler<L2LoginClient>
|
||||
public L2LoginClient(SecretKey blowfishKey)
|
||||
{
|
||||
super();
|
||||
_scrambledPair = LoginController.getInstance().getScrambledRSAKeyPair();
|
||||
_blowfishKey = blowfishKey;
|
||||
_scrambledPair = LoginController.getInstance().getScrambledRSAKeyPair();
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -115,16 +114,6 @@ public final class L2LoginClient extends ChannelInboundHandler<L2LoginClient>
|
||||
return _addr;
|
||||
}
|
||||
|
||||
public byte[] getScrambledModulus()
|
||||
{
|
||||
return _scrambledPair._scrambledModulus;
|
||||
}
|
||||
|
||||
public RSAPrivateKey getRSAPrivateKey()
|
||||
{
|
||||
return (RSAPrivateKey) _scrambledPair._pair.getPrivate();
|
||||
}
|
||||
|
||||
public String getAccount()
|
||||
{
|
||||
return _account;
|
||||
@@ -160,6 +149,11 @@ public final class L2LoginClient extends ChannelInboundHandler<L2LoginClient>
|
||||
return _sessionId;
|
||||
}
|
||||
|
||||
public ScrambledKeyPair getScrambledKeyPair()
|
||||
{
|
||||
return _scrambledPair;
|
||||
}
|
||||
|
||||
public boolean hasJoinedGS()
|
||||
{
|
||||
return _joinedGS;
|
||||
|
@@ -80,7 +80,7 @@ public class RequestAuthLogin implements IIncomingPacket<L2LoginClient>
|
||||
try
|
||||
{
|
||||
final Cipher rsaCipher = Cipher.getInstance("RSA/ECB/nopadding");
|
||||
rsaCipher.init(Cipher.DECRYPT_MODE, client.getRSAPrivateKey());
|
||||
rsaCipher.init(Cipher.DECRYPT_MODE, client.getScrambledKeyPair().getPrivateKey());
|
||||
rsaCipher.doFinal(_raw1, 0, 128, decrypted, 0);
|
||||
if (_newAuthMethod)
|
||||
{
|
||||
|
Reference in New Issue
Block a user