From 3de4fa7518284204a6a53af574b22217074a7ad1 Mon Sep 17 00:00:00 2001 From: Evgeny Poberezkin <2769109+epoberezkin@users.noreply.github.com> Date: Sun, 14 Feb 2021 12:00:04 +0000 Subject: [PATCH] Sign / verify SMP commands (#37) * generate key pair * crypto: sign/verify functions * remove extension * parse/serialize keys * use RSA recipient/sender keys (TODO sign/verify) * make PublicKey newtype, assign 0s to private_p & private_q * replace SMP command parsing with Attoparsec * rename types: Signed->Transmission, Transmission->SignedTransmission * sign and verify commands (server tests skipped, agent tests pass) * SMP client: avoid seralizing transmission twice when sending commands * update SMP server tests to use command signatures * remove support for "SEND :msg" syntax from SMP server protocol * rename RSA module name to R to avoid confusion with C used for S.M.Crypto * update key sizes to use bits `div` 8 * tidy up --- Main.hs | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/Main.hs b/Main.hs index 61bf9d81c2..f1685f0f9d 100644 --- a/Main.hs +++ b/Main.hs @@ -36,8 +36,9 @@ cfg :: AgentConfig cfg = AgentConfig { tcpPort = undefined, -- TODO maybe take it out of config - tbqSize = 16, + rsaKeySize = 2048 `div` 8, connIdBytes = 12, + tbqSize = 16, dbFile = "smp-chat.db", smpCfg = smpDefaultConfig }