database work
sqloomy
This commit is contained in:
parent
8960453143
commit
92a300c41f
6 changed files with 16 additions and 5 deletions
|
@ -9,7 +9,7 @@ using System.Globalization;
|
||||||
|
|
||||||
namespace CircleScape.Encryption {
|
namespace CircleScape.Encryption {
|
||||||
class Key {
|
class Key {
|
||||||
private BigInteger Secret;
|
private readonly static BigInteger Secret = RNG.NextPrime(512 / 8);
|
||||||
public BigInteger Generator { get; private set; } = 2;
|
public BigInteger Generator { get; private set; } = 2;
|
||||||
public BigInteger Modulus { get; private set; }
|
public BigInteger Modulus { get; private set; }
|
||||||
public BigInteger PrivateKey { get; private set; } = BigInteger.Zero;
|
public BigInteger PrivateKey { get; private set; } = BigInteger.Zero;
|
||||||
|
@ -18,7 +18,6 @@ namespace CircleScape.Encryption {
|
||||||
}
|
}
|
||||||
|
|
||||||
public Key() {
|
public Key() {
|
||||||
Secret = RNG.NextPrime(512 / 8);
|
|
||||||
Modulus = RNG.NextPrime(512 / 8);
|
Modulus = RNG.NextPrime(512 / 8);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -6,6 +6,7 @@ using System.Text;
|
||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
using Square;
|
using Square;
|
||||||
using System.IO;
|
using System.IO;
|
||||||
|
using System.Net;
|
||||||
|
|
||||||
namespace Kneesocks {
|
namespace Kneesocks {
|
||||||
public class Connection {
|
public class Connection {
|
||||||
|
@ -55,6 +56,12 @@ namespace Kneesocks {
|
||||||
public bool Handshaked { get; private set; } = false;
|
public bool Handshaked { get; private set; } = false;
|
||||||
public Handshake ClientHandshake { get; private set; } = null;
|
public Handshake ClientHandshake { get; private set; } = null;
|
||||||
|
|
||||||
|
public IPAddress IP {
|
||||||
|
get {
|
||||||
|
return ((IPEndPoint)Socket.Client.RemoteEndPoint).Address;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
public void Initialize(TcpClient sock) {
|
public void Initialize(TcpClient sock) {
|
||||||
if(Initialized)
|
if(Initialized)
|
||||||
return;
|
return;
|
||||||
|
|
|
@ -8,13 +8,12 @@ using Kneesocks;
|
||||||
using CircleScape.Encryption;
|
using CircleScape.Encryption;
|
||||||
|
|
||||||
namespace CircleScape {
|
namespace CircleScape {
|
||||||
class ActiveConnection : Kneesocks.Connection {
|
class ActiveConnection : Connection {
|
||||||
private Cipher Encryptor;
|
private Cipher Encryptor;
|
||||||
|
|
||||||
public void Initialize(PendingConnection conn) {
|
public void Initialize(PendingConnection conn) {
|
||||||
Initialize(conn, false);
|
Initialize(conn, false);
|
||||||
Encryptor = conn.Encryptor;
|
Encryptor = conn.Encryptor;
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -47,6 +47,12 @@ namespace CircleScape {
|
||||||
|
|
||||||
Encryptor = new Cipher(Key.PrivateKey);
|
Encryptor = new Cipher(Key.PrivateKey);
|
||||||
break;
|
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());
|
Console.WriteLine(Id + " says " + data.GetString());
|
||||||
|
|
BIN
server/scape.db
BIN
server/scape.db
Binary file not shown.
Loading…
Reference in a new issue