database work
sqloomy
This commit is contained in:
parent
8960453143
commit
92a300c41f
6 changed files with 16 additions and 5 deletions
|
@ -54,7 +54,7 @@ class Connection {
|
|||
CriticalStop.redirect("Could not establish an encrypted connection with the server.");
|
||||
break;
|
||||
case kPacketId.LoginAttempt:
|
||||
|
||||
|
||||
break;
|
||||
case kPacketId.RegistrationAttempt:
|
||||
|
||||
|
|
|
@ -9,7 +9,7 @@ using System.Globalization;
|
|||
|
||||
namespace CircleScape.Encryption {
|
||||
class Key {
|
||||
private BigInteger Secret;
|
||||
private readonly static BigInteger Secret = RNG.NextPrime(512 / 8);
|
||||
public BigInteger Generator { get; private set; } = 2;
|
||||
public BigInteger Modulus { get; private set; }
|
||||
public BigInteger PrivateKey { get; private set; } = BigInteger.Zero;
|
||||
|
@ -18,7 +18,6 @@ namespace CircleScape.Encryption {
|
|||
}
|
||||
|
||||
public Key() {
|
||||
Secret = RNG.NextPrime(512 / 8);
|
||||
Modulus = RNG.NextPrime(512 / 8);
|
||||
}
|
||||
|
||||
|
|
|
@ -6,6 +6,7 @@ using System.Text;
|
|||
using System.Threading.Tasks;
|
||||
using Square;
|
||||
using System.IO;
|
||||
using System.Net;
|
||||
|
||||
namespace Kneesocks {
|
||||
public class Connection {
|
||||
|
@ -55,6 +56,12 @@ namespace Kneesocks {
|
|||
public bool Handshaked { get; private set; } = false;
|
||||
public Handshake ClientHandshake { get; private set; } = null;
|
||||
|
||||
public IPAddress IP {
|
||||
get {
|
||||
return ((IPEndPoint)Socket.Client.RemoteEndPoint).Address;
|
||||
}
|
||||
}
|
||||
|
||||
public void Initialize(TcpClient sock) {
|
||||
if(Initialized)
|
||||
return;
|
||||
|
|
|
@ -8,13 +8,12 @@ using Kneesocks;
|
|||
using CircleScape.Encryption;
|
||||
|
||||
namespace CircleScape {
|
||||
class ActiveConnection : Kneesocks.Connection {
|
||||
class ActiveConnection : Connection {
|
||||
private Cipher Encryptor;
|
||||
|
||||
public void Initialize(PendingConnection conn) {
|
||||
Initialize(conn, false);
|
||||
Encryptor = conn.Encryptor;
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -47,6 +47,12 @@ namespace CircleScape {
|
|||
|
||||
Encryptor = new Cipher(Key.PrivateKey);
|
||||
break;
|
||||
case Packet.kId.LoginAttempt:
|
||||
|
||||
break;
|
||||
default:
|
||||
Disconnect(Frame.kClosingReason.ProtocolError, "Packet ID could not be understood at this time.");
|
||||
break;
|
||||
}
|
||||
|
||||
Console.WriteLine(Id + " says " + data.GetString());
|
||||
|
|
BIN
server/scape.db
BIN
server/scape.db
Binary file not shown.
Loading…
Reference in a new issue