diff --git a/README.md b/README.md
index 689eedf..d5f545e 100644
--- a/README.md
+++ b/README.md
@@ -9,3 +9,16 @@
[ ] Refine protocol using the implementation (and update stuff that got changed in impl)
[ ] Finish implementing the protocol
[ ] Update the protocol file with the latest structs and stuff
+
+## Protocol todo:
+
+[ ] Figure out how a message and message ack payload will look
+[ ] Figure out server responses (hopefully manages to be stuck in a 512 bit block as well)
+
+
+## client todo:
+
+[ ] Check for key when turned on
+ [ ] generate key and register if no key is preset, and save it after registration is done
+ [ ] if key is present, start by getting messages (which makes sure we are signed in)
+
diff --git a/client/Program.cs b/client/Program.cs
index 8381c75..a198e26 100644
--- a/client/Program.cs
+++ b/client/Program.cs
@@ -2,6 +2,8 @@
using System.Net.Sockets;
using System.Text;
using System.Threading.Tasks;
+using System.Security.Cryptography;
+using System.Linq;
namespace Client;
@@ -9,6 +11,10 @@ public class Program
{
static void Main(string[] args)
{
+
+ RSA key = RSA.Create(512);
+ Console.WriteLine($"key: {key.ExportRSAPrivateKey().Length}");
+ Console.WriteLine(key.ExportRSAPublicKeyPem());
using TcpClient client = new("127.0.0.1", 12345);
byte[] toSend = Encoding.ASCII.GetBytes("hello server");
@@ -29,6 +35,15 @@ public class Program
await Task.Delay(100);
continue;
}
+ else if(input.StartsWith('/')) {
+ // Commands :D, i like commands
+ switch(input.ToLower()) {
+ case "/quit":
+ case "/exit":
+ case "/q!":
+ return;
+ }
+ }
else {
stream.Write(Encoding.ASCII.GetBytes(input));
Console.WriteLine($"[{DateTime.Now}]Sent to server: {input}");
@@ -42,7 +57,7 @@ public class Program
int readLen = await stream.ReadAsync(buffer);
if(readLen != 0) {
string fromServer = Encoding.ASCII.GetString(buffer[..readLen]);
- Console.WriteLine($"[{DateTime.Now}]\t\tFrom server: {fromServer}");
+ Console.WriteLine($"[{DateTime.Now}] From server: {fromServer}");
}
}
diff --git a/client/client.csproj b/client/client.csproj
index 84912b2..36cc8b1 100644
--- a/client/client.csproj
+++ b/client/client.csproj
@@ -1,14 +1,14 @@
-
-
+
+
+
+
-
Exe
net8.0
disable
enable
-
-
+
\ No newline at end of file
diff --git a/lib/Crypto.cs b/lib/Crypto.cs
new file mode 100644
index 0000000..30d4c2b
--- /dev/null
+++ b/lib/Crypto.cs
@@ -0,0 +1,11 @@
+using System.Security.Cryptography;
+
+namespace lib;
+
+public static class Crypto {
+ public static RSA GenerateKey() {
+ return RSA.Create(512);
+ }
+
+
+}
\ No newline at end of file
diff --git a/lib/lib.csproj b/lib/lib.csproj
index fa71b7a..73ce23e 100644
--- a/lib/lib.csproj
+++ b/lib/lib.csproj
@@ -1,5 +1,8 @@
+
+
+
net8.0
enable
diff --git a/protocol.md b/protocol.md
index 26b32d8..a691e53 100644
--- a/protocol.md
+++ b/protocol.md
@@ -76,7 +76,9 @@ I think it all can go into a:
```
and we can just append encrypted payloads to it (in SendMessage and SendAck)
-To each message we also append a sha3-256 signed hash
+To each message we also append a sha3-256 signed hash, this shit really feels like overkill and im not sure about it,
+on the other i do want to have a bigger key size and 512 seems like an okay-ish thing to have, as 256 is short and 1024 is
+amusingly long for the amount of data the server needs to encrypt
enc_server( request - 256 bits, signed sha3-256 )