Java 类net.minecraft.util.CryptManager 实例源码
项目:CustomWorldGen
文件:IntegratedServer.java
/**
* Initialises the server and starts it.
*/
public boolean startServer() throws IOException
{
LOGGER.info("Starting integrated minecraft server version 1.10.2");
this.setOnlineMode(true);
this.setCanSpawnAnimals(true);
this.setCanSpawnNPCs(true);
this.setAllowPvp(true);
this.setAllowFlight(true);
LOGGER.info("Generating keypair");
this.setKeyPair(CryptManager.generateKeyPair());
if (!net.minecraftforge.fml.common.FMLCommonHandler.instance().handleServerAboutToStart(this)) return false;
this.loadAllWorlds(this.getFolderName(), this.getWorldName(), this.theWorldSettings.getSeed(), this.theWorldSettings.getTerrainType(), this.theWorldSettings.getGeneratorOptions());
this.setMOTD(this.getServerOwner() + " - " + this.worldServers[0].getWorldInfo().getWorldName());
return net.minecraftforge.fml.common.FMLCommonHandler.instance().handleServerStarting(this);
}
项目:RuneCraftery
文件:ThreadLoginVerifier.java
public void run() {
try {
String var1 = (new BigInteger(CryptManager.func_75895_a(NetLoginHandler.func_72526_a(this.field_72590_a), NetLoginHandler.func_72530_b(this.field_72590_a).func_71250_E().getPublic(), NetLoginHandler.func_72525_c(this.field_72590_a)))).toString(16);
URL var2 = new URL("http://session.minecraft.net/game/checkserver.jsp?user=" + URLEncoder.encode(NetLoginHandler.func_72533_d(this.field_72590_a), "UTF-8") + "&serverId=" + URLEncoder.encode(var1, "UTF-8"));
BufferedReader var3 = new BufferedReader(new InputStreamReader(var2.openConnection(NetLoginHandler.func_72530_b(this.field_72590_a).func_110454_ao()).getInputStream()));
String var4 = var3.readLine();
var3.close();
if(!"YES".equals(var4)) {
this.field_72590_a.func_72527_a("Failed to verify username!");
return;
}
NetLoginHandler.func_72531_a(this.field_72590_a, true);
} catch (Exception var5) {
this.field_72590_a.func_72527_a("Failed to verify username! [internal error " + var5 + "]");
var5.printStackTrace();
}
}
项目:RuneCraftery
文件:ThreadLoginVerifier.java
public void run()
{
try
{
String s = (new BigInteger(CryptManager.getServerIdHash(NetLoginHandler.getServerId(this.loginHandler), NetLoginHandler.getLoginMinecraftServer(this.loginHandler).getKeyPair().getPublic(), NetLoginHandler.getSharedKey(this.loginHandler)))).toString(16);
URL url = new URL("http://session.minecraft.net/game/checkserver.jsp?user=" + URLEncoder.encode(NetLoginHandler.getClientUsername(this.loginHandler), "UTF-8") + "&serverId=" + URLEncoder.encode(s, "UTF-8"));
BufferedReader bufferedreader = new BufferedReader(new InputStreamReader(url.openConnection(NetLoginHandler.getLoginMinecraftServer(this.loginHandler).getServerProxy()).getInputStream()));
String s1 = bufferedreader.readLine();
bufferedreader.close();
if (!"YES".equals(s1))
{
this.loginHandler.raiseErrorAndDisconnect("Failed to verify username!");
return;
}
NetLoginHandler.func_72531_a(this.loginHandler, true);
}
catch (Exception exception)
{
this.loginHandler.raiseErrorAndDisconnect("Failed to verify username! [internal error " + exception + "]");
exception.printStackTrace();
}
}
项目:RuneCraftery
文件:NetClientHandler.java
public void handleServerAuthData(Packet253ServerAuthData par1Packet253ServerAuthData)
{
String s = par1Packet253ServerAuthData.getServerId().trim();
PublicKey publickey = par1Packet253ServerAuthData.getPublicKey();
SecretKey secretkey = CryptManager.createNewSharedKey();
if (!"-".equals(s))
{
String s1 = (new BigInteger(CryptManager.getServerIdHash(s, publickey, secretkey))).toString(16);
String s2 = this.sendSessionRequest(this.mc.getSession().getUsername(), this.mc.getSession().getSessionID(), s1);
if (!"ok".equalsIgnoreCase(s2))
{
this.netManager.networkShutdown("disconnect.loginFailedInfo", new Object[] {s2});
return;
}
}
this.addToSendQueue(new Packet252SharedKey(secretkey, publickey, par1Packet253ServerAuthData.getVerifyToken()));
}
项目:RuneCraftery
文件:IntegratedServer.java
/**
* Initialises the server and starts it.
*/
protected boolean startServer() throws IOException
{
this.serverLogAgent.logInfo("Starting integrated minecraft server version 1.6.4");
this.setOnlineMode(false);
this.setCanSpawnAnimals(true);
this.setCanSpawnNPCs(true);
this.setAllowPvp(true);
this.setAllowFlight(true);
this.serverLogAgent.logInfo("Generating keypair");
this.setKeyPair(CryptManager.createNewKeyPair());
if (!FMLCommonHandler.instance().handleServerAboutToStart(this)) { return false; }
this.loadAllWorlds(this.getFolderName(), this.getWorldName(), this.theWorldSettings.getSeed(), this.theWorldSettings.getTerrainType(), this.theWorldSettings.func_82749_j());
this.setMOTD(this.getServerOwner() + " - " + this.worldServers[0].getWorldInfo().getWorldName());
return FMLCommonHandler.instance().handleServerStarting(this);
}
项目:BetterNutritionMod
文件:ThreadLoginVerifier.java
public void run()
{
try
{
String s = (new BigInteger(CryptManager.getServerIdHash(NetLoginHandler.getServerId(this.loginHandler), NetLoginHandler.getLoginMinecraftServer(this.loginHandler).getKeyPair().getPublic(), NetLoginHandler.getSharedKey(this.loginHandler)))).toString(16);
URL url = new URL("http://session.minecraft.net/game/checkserver.jsp?user=" + URLEncoder.encode(NetLoginHandler.getClientUsername(this.loginHandler), "UTF-8") + "&serverId=" + URLEncoder.encode(s, "UTF-8"));
BufferedReader bufferedreader = new BufferedReader(new InputStreamReader(url.openConnection(NetLoginHandler.getLoginMinecraftServer(this.loginHandler).getServerProxy()).getInputStream()));
String s1 = bufferedreader.readLine();
bufferedreader.close();
if (!"YES".equals(s1))
{
this.loginHandler.raiseErrorAndDisconnect("Failed to verify username!");
return;
}
NetLoginHandler.func_72531_a(this.loginHandler, true);
}
catch (Exception exception)
{
this.loginHandler.raiseErrorAndDisconnect("Failed to verify username! [internal error " + exception + "]");
exception.printStackTrace();
}
}
项目:BetterNutritionMod
文件:NetClientHandler.java
public void handleServerAuthData(Packet253ServerAuthData par1Packet253ServerAuthData)
{
String s = par1Packet253ServerAuthData.getServerId().trim();
PublicKey publickey = par1Packet253ServerAuthData.getPublicKey();
SecretKey secretkey = CryptManager.createNewSharedKey();
if (!"-".equals(s))
{
String s1 = (new BigInteger(CryptManager.getServerIdHash(s, publickey, secretkey))).toString(16);
String s2 = this.sendSessionRequest(this.mc.getSession().getUsername(), this.mc.getSession().getSessionID(), s1);
if (!"ok".equalsIgnoreCase(s2))
{
this.netManager.networkShutdown("disconnect.loginFailedInfo", new Object[] {s2});
return;
}
}
this.addToSendQueue(new Packet252SharedKey(secretkey, publickey, par1Packet253ServerAuthData.getVerifyToken()));
}
项目:BetterNutritionMod
文件:IntegratedServer.java
/**
* Initialises the server and starts it.
*/
protected boolean startServer() throws IOException
{
this.serverLogAgent.logInfo("Starting integrated minecraft server version 1.6.4");
this.setOnlineMode(false);
this.setCanSpawnAnimals(true);
this.setCanSpawnNPCs(true);
this.setAllowPvp(true);
this.setAllowFlight(true);
this.serverLogAgent.logInfo("Generating keypair");
this.setKeyPair(CryptManager.createNewKeyPair());
if (!FMLCommonHandler.instance().handleServerAboutToStart(this)) { return false; }
this.loadAllWorlds(this.getFolderName(), this.getWorldName(), this.theWorldSettings.getSeed(), this.theWorldSettings.getTerrainType(), this.theWorldSettings.func_82749_j());
this.setMOTD(this.getServerOwner() + " - " + this.worldServers[0].getWorldInfo().getWorldName());
return FMLCommonHandler.instance().handleServerStarting(this);
}
项目:DecompiledMinecraft
文件:S01PacketEncryptionRequest.java
/**
* Reads the raw packet data from the data stream.
*/
public void readPacketData(PacketBuffer buf) throws IOException
{
this.hashedServerId = buf.readStringFromBuffer(20);
this.publicKey = CryptManager.decodePublicKey(buf.readByteArray());
this.verifyToken = buf.readByteArray();
}
项目:DecompiledMinecraft
文件:NetworkManager.java
/**
* Adds an encoder+decoder to the channel pipeline. The parameter is the secret key used for encrypted communication
*/
public void enableEncryption(SecretKey key)
{
this.isEncrypted = true;
this.channel.pipeline().addBefore("splitter", "decrypt", new NettyEncryptingDecoder(CryptManager.createNetCipherInstance(2, key)));
this.channel.pipeline().addBefore("prepender", "encrypt", new NettyEncryptingEncoder(CryptManager.createNetCipherInstance(1, key)));
}
项目:DecompiledMinecraft
文件:S01PacketEncryptionRequest.java
/**
* Reads the raw packet data from the data stream.
*/
public void readPacketData(PacketBuffer buf) throws IOException
{
this.hashedServerId = buf.readStringFromBuffer(20);
this.publicKey = CryptManager.decodePublicKey(buf.readByteArray());
this.verifyToken = buf.readByteArray();
}
项目:DecompiledMinecraft
文件:NetworkManager.java
/**
* Adds an encoder+decoder to the channel pipeline. The parameter is the secret key used for encrypted communication
*/
public void enableEncryption(SecretKey key)
{
this.isEncrypted = true;
this.channel.pipeline().addBefore("splitter", "decrypt", new NettyEncryptingDecoder(CryptManager.createNetCipherInstance(2, key)));
this.channel.pipeline().addBefore("prepender", "encrypt", new NettyEncryptingEncoder(CryptManager.createNetCipherInstance(1, key)));
}
项目:DecompiledMinecraft
文件:IntegratedServer.java
/**
* Initialises the server and starts it.
*/
protected boolean startServer() throws IOException
{
logger.info("Starting integrated minecraft server version 1.8.8");
this.setOnlineMode(true);
this.setCanSpawnAnimals(true);
this.setCanSpawnNPCs(true);
this.setAllowPvp(true);
this.setAllowFlight(true);
logger.info("Generating keypair");
this.setKeyPair(CryptManager.generateKeyPair());
this.loadAllWorlds(this.getFolderName(), this.getWorldName(), this.theWorldSettings.getSeed(), this.theWorldSettings.getTerrainType(), this.theWorldSettings.getWorldName());
this.setMOTD(this.getServerOwner() + " - " + this.worldServers[0].getWorldInfo().getWorldName());
return true;
}
项目:BaseClient
文件:S01PacketEncryptionRequest.java
/**
* Reads the raw packet data from the data stream.
*/
public void readPacketData(PacketBuffer buf) throws IOException
{
this.hashedServerId = buf.readStringFromBuffer(20);
this.publicKey = CryptManager.decodePublicKey(buf.readByteArray());
this.verifyToken = buf.readByteArray();
}
项目:BaseClient
文件:NetworkManager.java
/**
* Adds an encoder+decoder to the channel pipeline. The parameter is the secret key used for encrypted communication
*/
public void enableEncryption(SecretKey key)
{
this.isEncrypted = true;
this.channel.pipeline().addBefore("splitter", "decrypt", new NettyEncryptingDecoder(CryptManager.createNetCipherInstance(2, key)));
this.channel.pipeline().addBefore("prepender", "encrypt", new NettyEncryptingEncoder(CryptManager.createNetCipherInstance(1, key)));
}
项目:BaseClient
文件:IntegratedServer.java
/**
* Initialises the server and starts it.
*/
protected boolean startServer() throws IOException
{
logger.info("Starting integrated minecraft server version 1.8.8");
this.setOnlineMode(true);
this.setCanSpawnAnimals(true);
this.setCanSpawnNPCs(true);
this.setAllowPvp(true);
this.setAllowFlight(true);
logger.info("Generating keypair");
this.setKeyPair(CryptManager.generateKeyPair());
if (Reflector.FMLCommonHandler_handleServerAboutToStart.exists())
{
Object object = Reflector.call(Reflector.FMLCommonHandler_instance, new Object[0]);
if (!Reflector.callBoolean(object, Reflector.FMLCommonHandler_handleServerAboutToStart, new Object[] {this}))
{
return false;
}
}
this.loadAllWorlds(this.getFolderName(), this.getWorldName(), this.theWorldSettings.getSeed(), this.theWorldSettings.getTerrainType(), this.theWorldSettings.getWorldName());
this.setMOTD(this.getServerOwner() + " - " + this.worldServers[0].getWorldInfo().getWorldName());
if (Reflector.FMLCommonHandler_handleServerStarting.exists())
{
Object object1 = Reflector.call(Reflector.FMLCommonHandler_instance, new Object[0]);
if (Reflector.FMLCommonHandler_handleServerStarting.getReturnType() == Boolean.TYPE)
{
return Reflector.callBoolean(object1, Reflector.FMLCommonHandler_handleServerStarting, new Object[] {this});
}
Reflector.callVoid(object1, Reflector.FMLCommonHandler_handleServerStarting, new Object[] {this});
}
return true;
}
项目:BaseClient
文件:S01PacketEncryptionRequest.java
/**
* Reads the raw packet data from the data stream.
*/
public void readPacketData(PacketBuffer buf) throws IOException
{
this.hashedServerId = buf.readStringFromBuffer(20);
this.publicKey = CryptManager.decodePublicKey(buf.readByteArray());
this.verifyToken = buf.readByteArray();
}
项目:BaseClient
文件:NetworkManager.java
/**
* Adds an encoder+decoder to the channel pipeline. The parameter is the secret key used for encrypted communication
*/
public void enableEncryption(SecretKey key)
{
this.isEncrypted = true;
this.channel.pipeline().addBefore("splitter", "decrypt", new NettyEncryptingDecoder(CryptManager.createNetCipherInstance(2, key)));
this.channel.pipeline().addBefore("prepender", "encrypt", new NettyEncryptingEncoder(CryptManager.createNetCipherInstance(1, key)));
}
项目:BaseClient
文件:IntegratedServer.java
/**
* Initialises the server and starts it.
*/
protected boolean startServer() throws IOException
{
logger.info("Starting integrated minecraft server version 1.8.8");
this.setOnlineMode(true);
this.setCanSpawnAnimals(true);
this.setCanSpawnNPCs(true);
this.setAllowPvp(true);
this.setAllowFlight(true);
logger.info("Generating keypair");
this.setKeyPair(CryptManager.generateKeyPair());
if (Reflector.FMLCommonHandler_handleServerAboutToStart.exists())
{
Object object = Reflector.call(Reflector.FMLCommonHandler_instance, new Object[0]);
if (!Reflector.callBoolean(object, Reflector.FMLCommonHandler_handleServerAboutToStart, new Object[] {this}))
{
return false;
}
}
this.loadAllWorlds(this.getFolderName(), this.getWorldName(), this.theWorldSettings.getSeed(), this.theWorldSettings.getTerrainType(), this.theWorldSettings.getWorldName());
this.setMOTD(this.getServerOwner() + " - " + this.worldServers[0].getWorldInfo().getWorldName());
if (Reflector.FMLCommonHandler_handleServerStarting.exists())
{
Object object1 = Reflector.call(Reflector.FMLCommonHandler_instance, new Object[0]);
if (Reflector.FMLCommonHandler_handleServerStarting.getReturnType() == Boolean.TYPE)
{
return Reflector.callBoolean(object1, Reflector.FMLCommonHandler_handleServerStarting, new Object[] {this});
}
Reflector.callVoid(object1, Reflector.FMLCommonHandler_handleServerStarting, new Object[] {this});
}
return true;
}
项目:Backmemed
文件:SPacketEncryptionRequest.java
/**
* Reads the raw packet data from the data stream.
*/
public void readPacketData(PacketBuffer buf) throws IOException
{
this.hashedServerId = buf.readStringFromBuffer(20);
this.publicKey = CryptManager.decodePublicKey(buf.readByteArray());
this.verifyToken = buf.readByteArray();
}
项目:Backmemed
文件:NetworkManager.java
/**
* Adds an encoder+decoder to the channel pipeline. The parameter is the secret key used for encrypted communication
*/
public void enableEncryption(SecretKey key)
{
this.isEncrypted = true;
this.channel.pipeline().addBefore("splitter", "decrypt", new NettyEncryptingDecoder(CryptManager.createNetCipherInstance(2, key)));
this.channel.pipeline().addBefore("prepender", "encrypt", new NettyEncryptingEncoder(CryptManager.createNetCipherInstance(1, key)));
}
项目:Backmemed
文件:IntegratedServer.java
/**
* Initialises the server and starts it.
*/
public boolean startServer() throws IOException
{
LOGGER.info("Starting integrated minecraft server version 1.11.2");
this.setOnlineMode(true);
this.setCanSpawnAnimals(true);
this.setCanSpawnNPCs(true);
this.setAllowPvp(true);
this.setAllowFlight(true);
LOGGER.info("Generating keypair");
this.setKeyPair(CryptManager.generateKeyPair());
if (Reflector.FMLCommonHandler_handleServerAboutToStart.exists())
{
Object object = Reflector.call(Reflector.FMLCommonHandler_instance, new Object[0]);
if (!Reflector.callBoolean(object, Reflector.FMLCommonHandler_handleServerAboutToStart, new Object[] {this}))
{
return false;
}
}
this.loadAllWorlds(this.getFolderName(), this.getWorldName(), this.theWorldSettings.getSeed(), this.theWorldSettings.getTerrainType(), this.theWorldSettings.getGeneratorOptions());
this.setMOTD(this.getServerOwner() + " - " + this.worldServers[0].getWorldInfo().getWorldName());
if (Reflector.FMLCommonHandler_handleServerStarting.exists())
{
Object object1 = Reflector.call(Reflector.FMLCommonHandler_instance, new Object[0]);
if (Reflector.FMLCommonHandler_handleServerStarting.getReturnType() == Boolean.TYPE)
{
return Reflector.callBoolean(object1, Reflector.FMLCommonHandler_handleServerStarting, new Object[] {this});
}
Reflector.callVoid(object1, Reflector.FMLCommonHandler_handleServerStarting, new Object[] {this});
}
return true;
}
项目:CustomWorldGen
文件:SPacketEncryptionRequest.java
/**
* Reads the raw packet data from the data stream.
*/
public void readPacketData(PacketBuffer buf) throws IOException
{
this.hashedServerId = buf.readStringFromBuffer(20);
this.publicKey = CryptManager.decodePublicKey(buf.readByteArray());
this.verifyToken = buf.readByteArray();
}
项目:CustomWorldGen
文件:NetworkManager.java
/**
* Adds an encoder+decoder to the channel pipeline. The parameter is the secret key used for encrypted communication
*/
public void enableEncryption(SecretKey key)
{
this.isEncrypted = true;
this.channel.pipeline().addBefore("splitter", "decrypt", new NettyEncryptingDecoder(CryptManager.createNetCipherInstance(2, key)));
this.channel.pipeline().addBefore("prepender", "encrypt", new NettyEncryptingEncoder(CryptManager.createNetCipherInstance(1, key)));
}
项目:Resilience-Client-Source
文件:S01PacketEncryptionRequest.java
/**
* Reads the raw packet data from the data stream.
*/
public void readPacketData(PacketBuffer p_148837_1_) throws IOException
{
this.field_149612_a = p_148837_1_.readStringFromBuffer(20);
this.field_149610_b = CryptManager.decodePublicKey(readBlob(p_148837_1_));
this.field_149611_c = readBlob(p_148837_1_);
}
项目: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);
}
}
});
}
项目:Resilience-Client-Source
文件:IntegratedServer.java
/**
* Initialises the server and starts it.
*/
protected boolean startServer() throws IOException
{
logger.info("Starting integrated minecraft server version 1.7.2");
this.setOnlineMode(false);
this.setCanSpawnAnimals(true);
this.setCanSpawnNPCs(true);
this.setAllowPvp(true);
this.setAllowFlight(true);
logger.info("Generating keypair");
this.setKeyPair(CryptManager.createNewKeyPair());
Object inst;
if (Reflector.FMLCommonHandler_handleServerAboutToStart.exists())
{
inst = Reflector.call(Reflector.FMLCommonHandler_instance, new Object[0]);
if (!Reflector.callBoolean(inst, Reflector.FMLCommonHandler_handleServerAboutToStart, new Object[] {this}))
{
return false;
}
}
this.loadAllWorlds(this.getFolderName(), this.getWorldName(), this.theWorldSettings.getSeed(), this.theWorldSettings.getTerrainType(), this.theWorldSettings.func_82749_j());
this.setMOTD(this.getServerOwner() + " - " + this.worldServers[0].getWorldInfo().getWorldName());
if (Reflector.FMLCommonHandler_handleServerStarting.exists())
{
inst = Reflector.call(Reflector.FMLCommonHandler_instance, new Object[0]);
if (Reflector.FMLCommonHandler_handleServerStarting.getReturnType() == Boolean.TYPE)
{
return Reflector.callBoolean(inst, Reflector.FMLCommonHandler_handleServerStarting, new Object[] {this});
}
Reflector.callVoid(inst, Reflector.FMLCommonHandler_handleServerStarting, new Object[] {this});
}
return true;
}
项目:ExpandedRailsMod
文件:NetworkManager.java
/**
* Adds an encoder+decoder to the channel pipeline. The parameter is the secret key used for encrypted communication
*/
public void enableEncryption(SecretKey key)
{
this.isEncrypted = true;
this.channel.pipeline().addBefore("splitter", "decrypt", new NettyEncryptingDecoder(CryptManager.createNetCipherInstance(2, key)));
this.channel.pipeline().addBefore("prepender", "encrypt", new NettyEncryptingEncoder(CryptManager.createNetCipherInstance(1, key)));
}
项目:Cauldron
文件:IntegratedServer.java
protected boolean startServer() throws java.net.UnknownHostException // Cauldron
{
logger.info("Starting integrated minecraft server version 1.7.10");
this.setOnlineMode(true);
this.setCanSpawnAnimals(true);
this.setCanSpawnNPCs(true);
this.setAllowPvp(true);
this.setAllowFlight(true);
logger.info("Generating keypair");
this.setKeyPair(CryptManager.createNewKeyPair());
if (!FMLCommonHandler.instance().handleServerAboutToStart(this)) { return false; }
this.loadAllWorlds(this.getFolderName(), this.getWorldName(), this.theWorldSettings.getSeed(), this.theWorldSettings.getTerrainType(), this.theWorldSettings.func_82749_j());
this.setMOTD(this.getServerOwner() + " - " + this.worldServers[0].getWorldInfo().getWorldName());
return FMLCommonHandler.instance().handleServerStarting(this);
}
项目:Cauldron
文件:IntegratedServer.java
protected boolean startServer() throws IOException
{
logger.info("Starting integrated minecraft server version 1.7.10");
this.setOnlineMode(true);
this.setCanSpawnAnimals(true);
this.setCanSpawnNPCs(true);
this.setAllowPvp(true);
this.setAllowFlight(true);
logger.info("Generating keypair");
this.setKeyPair(CryptManager.createNewKeyPair());
if (!FMLCommonHandler.instance().handleServerAboutToStart(this)) { return false; }
this.loadAllWorlds(this.getFolderName(), this.getWorldName(), this.theWorldSettings.getSeed(), this.theWorldSettings.getTerrainType(), this.theWorldSettings.func_82749_j());
this.setMOTD(this.getServerOwner() + " - " + this.worldServers[0].getWorldInfo().getWorldName());
return FMLCommonHandler.instance().handleServerStarting(this);
}
项目:RuneCraftery
文件:NetClientHandler.java
public void func_72470_a(Packet253ServerAuthData p_72470_1_) {
String var2 = p_72470_1_.func_73377_d().trim();
PublicKey var3 = p_72470_1_.func_73376_f();
SecretKey var4 = CryptManager.func_75890_a();
if(!"-".equals(var2)) {
String var5 = (new BigInteger(CryptManager.func_75895_a(var2, var3, var4))).toString(16);
String var6 = this.func_72550_a(this.field_72563_h.func_110432_I().func_111285_a(), this.field_72563_h.func_110432_I().func_111286_b(), var5);
if(!"ok".equalsIgnoreCase(var6)) {
this.field_72555_g.func_74424_a("disconnect.loginFailedInfo", new Object[]{var6});
return;
}
}
this.func_72552_c(new Packet252SharedKey(var4, var3, p_72470_1_.func_73378_g()));
}
项目:RuneCraftery
文件:IntegratedServer.java
protected boolean func_71197_b() throws IOException {
this.field_98130_m.func_98233_a("Starting integrated minecraft server version 1.6.4");
this.func_71229_d(false);
this.func_71251_e(true);
this.func_71257_f(true);
this.func_71188_g(true);
this.func_71245_h(true);
this.field_98130_m.func_98233_a("Generating keypair");
this.func_71253_a(CryptManager.func_75891_b());
this.func_71247_a(this.func_71270_I(), this.func_71221_J(), this.field_71350_m.func_77160_d(), this.field_71350_m.func_77165_h(), this.field_71350_m.func_82749_j());
this.func_71205_p(this.func_71214_G() + " - " + this.field_71305_c[0].func_72912_H().func_76065_j());
return true;
}
项目:RuneCraftery
文件:TcpConnection.java
/**
* flushes the stream and replaces it with an encryptedOutputStream
*/
private void encryptOuputStream() throws IOException
{
this.socketOutputStream.flush();
this.isOutputEncrypted = true;
BufferedOutputStream bufferedoutputstream = new BufferedOutputStream(CryptManager.encryptOuputStream(this.sharedKeyForEncryption, this.networkSocket.getOutputStream()), 5120);
this.socketOutputStream = new DataOutputStream(bufferedoutputstream);
}
项目:RuneCraftery
文件:Packet252SharedKey.java
@SideOnly(Side.CLIENT)
public Packet252SharedKey(SecretKey par1SecretKey, PublicKey par2PublicKey, byte[] par3ArrayOfByte)
{
this.sharedKey = par1SecretKey;
this.sharedSecret = CryptManager.encryptData(par2PublicKey, par1SecretKey.getEncoded());
this.verifyToken = CryptManager.encryptData(par2PublicKey, par3ArrayOfByte);
}
项目:RuneCraftery
文件:Packet253ServerAuthData.java
/**
* Abstract. Reads the raw packet data from the data stream.
*/
public void readPacketData(DataInput par1DataInput) throws IOException
{
this.serverId = readString(par1DataInput, 20);
this.publicKey = CryptManager.decodePublicKey(readBytesFromStream(par1DataInput));
this.verifyToken = readBytesFromStream(par1DataInput);
}
项目:BetterNutritionMod
文件:TcpConnection.java
/**
* flushes the stream and replaces it with an encryptedOutputStream
*/
private void encryptOuputStream() throws IOException
{
this.socketOutputStream.flush();
this.isOutputEncrypted = true;
BufferedOutputStream bufferedoutputstream = new BufferedOutputStream(CryptManager.encryptOuputStream(this.sharedKeyForEncryption, this.networkSocket.getOutputStream()), 5120);
this.socketOutputStream = new DataOutputStream(bufferedoutputstream);
}
项目:BetterNutritionMod
文件:Packet252SharedKey.java
@SideOnly(Side.CLIENT)
public Packet252SharedKey(SecretKey par1SecretKey, PublicKey par2PublicKey, byte[] par3ArrayOfByte)
{
this.sharedKey = par1SecretKey;
this.sharedSecret = CryptManager.encryptData(par2PublicKey, par1SecretKey.getEncoded());
this.verifyToken = CryptManager.encryptData(par2PublicKey, par3ArrayOfByte);
}
项目:BetterNutritionMod
文件:Packet253ServerAuthData.java
/**
* Abstract. Reads the raw packet data from the data stream.
*/
public void readPacketData(DataInput par1DataInput) throws IOException
{
this.serverId = readString(par1DataInput, 20);
this.publicKey = CryptManager.decodePublicKey(readBytesFromStream(par1DataInput));
this.verifyToken = readBytesFromStream(par1DataInput);
}
项目:Uranium
文件:ThreadPlayerLookupUUID.java
public void run()
{
GameProfile gameprofile = NetHandlerLoginServer.getGameProfile(this.field_151292_a);
try
{
// Spigot Start
if (!this.mcServer.isServerInOnlineMode())
{
this.field_151292_a.initUUID();
fireLoginEvents();
return;
}
// Spigot End
String s = (new BigInteger(CryptManager.getServerIdHash(NetHandlerLoginServer.getLoginServerId(this.field_151292_a), this.mcServer.getKeyPair().getPublic(), NetHandlerLoginServer.getSecretKey(this.field_151292_a)))).toString(16);
GameProfile profile = this.mcServer.func_147130_as().hasJoinedServer(new GameProfile((UUID)null, gameprofile.getName()), s);
if (profile != null) {
NetHandlerLoginServer.processPlayerLoginGameProfile(this.field_151292_a, profile);
fireLoginEvents(); // Spigot
}
else if (this.mcServer.isSinglePlayer())
{
NetHandlerLoginServer.getLogger().warn("Failed to verify username but will let them in anyway!");
NetHandlerLoginServer.processPlayerLoginGameProfile(this.field_151292_a, this.field_151292_a.func_152506_a(gameprofile));
NetHandlerLoginServer.setLoginState(this.field_151292_a, LoginState.READY_TO_ACCEPT);
}
else
{
this.field_151292_a.func_147322_a("Failed to verify username!");
NetHandlerLoginServer.getLogger().error("Username \'" + NetHandlerLoginServer.getGameProfile(this.field_151292_a).getName() + "\' tried to join with an invalid session");
}
}
catch (AuthenticationUnavailableException authenticationunavailableexception)
{
if (this.mcServer.isSinglePlayer())
{
NetHandlerLoginServer.getLogger().warn("Authentication servers are down but will let them in anyway!");
NetHandlerLoginServer.processPlayerLoginGameProfile(this.field_151292_a, this.field_151292_a.func_152506_a(gameprofile));
NetHandlerLoginServer.setLoginState(this.field_151292_a, LoginState.READY_TO_ACCEPT);
}
else
{
this.field_151292_a.func_147322_a("Authentication servers are down. Please try again later, sorry!");
NetHandlerLoginServer.getLogger().error("Couldn\'t verify username because servers are unavailable");
}
// CraftBukkit start - catch all exceptions
}
catch (Exception exception)
{
this.field_151292_a.func_147322_a("Failed to verify username!");
this.mcServer.server.getLogger().log(java.util.logging.Level.WARNING, "Exception verifying " + NetHandlerLoginServer.getGameProfile(this.field_151292_a).getName(), exception);
// CraftBukkit end
}
}
项目:DecompiledMinecraft
文件:C01PacketEncryptionResponse.java
public SecretKey getSecretKey(PrivateKey key)
{
return CryptManager.decryptSharedKey(key, this.secretKeyEncrypted);
}