database work

sqloomy
This commit is contained in:
Malloc of Kuzkycyziklistan 2017-05-30 16:05:02 -05:00
parent 8960453143
commit 92a300c41f
6 changed files with 16 additions and 5 deletions

View file

@ -54,7 +54,7 @@ class Connection {
CriticalStop.redirect("Could not establish an encrypted connection with the server."); CriticalStop.redirect("Could not establish an encrypted connection with the server.");
break; break;
case kPacketId.LoginAttempt: case kPacketId.LoginAttempt:
break; break;
case kPacketId.RegistrationAttempt: case kPacketId.RegistrationAttempt:

View file

@ -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);
} }

View file

@ -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;

View file

@ -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;
} }
} }
} }

View file

@ -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());

Binary file not shown.