Implemented ECDH key exchange using ed25519 to share a symmetric AES key without transmitting it over the network.

This commit is contained in:
Jakob Friedl
2025-07-24 15:31:46 +02:00
parent cf4e4a7017
commit b6c720ccca
11 changed files with 166 additions and 45 deletions

View File

@@ -52,6 +52,8 @@ type
# Encryption
type
Key* = array[32, byte]
PublicKey* = array[32, byte]
PrivateKey* = array[64, byte]
Iv* = array[12, byte]
AuthenticationTag* = array[16, byte]
@@ -133,7 +135,7 @@ type
AgentRegistrationData* = object
header*: Header
sessionKey*: Key # [32 bytes ] AES 256 session key
agentPublicKey*: Key # [32 bytes ] Public key of the connecting agent for key exchange
metadata*: AgentMetadata
# Agent structure
@@ -168,12 +170,17 @@ type
# Server structure
type
KeyPair* = object
privateKey*: PrivateKey
publicKey*: Key
Conquest* = ref object
prompt*: Prompt
dbPath*: string
listeners*: Table[string, Listener]
agents*: Table[string, Agent]
interactAgent*: Agent
keyPair*: KeyPair
# Agent Config
type
@@ -183,4 +190,5 @@ type
ip*: string
port*: int
sleep*: int
sessionKey*: Key
sessionKey*: Key
agentPublicKey*: PublicKey