From 6864784cc37ea981865e72fc85e1315ce7fb430e Mon Sep 17 00:00:00 2001
From: JesseTheRobot <jesse.cruz.wright@gmail.com>
Date: Mon, 9 May 2022 11:58:53 +0000
Subject: [PATCH] changes

---
 cw/src/client.ts | 3 ++-
 cw/src/utils.ts  | 6 +++++-
 2 files changed, 7 insertions(+), 2 deletions(-)

diff --git a/cw/src/client.ts b/cw/src/client.ts
index 2a7b840..12f2a26 100644
--- a/cw/src/client.ts
+++ b/cw/src/client.ts
@@ -88,7 +88,8 @@ async function main() {
     await sendEncCheck(write, waitForData, destroy, serverPubKey)
 
     const { key, iv } = await receiveSymKey(waitForData, destroy, write, privKey, serverPubKey)
-    console.log("received encryption key")
+    console.log("received encryption key", key)
+    console.log("received IV", iv)
 
     let cipher = createCipheriv("aes-256-ctr", key, iv)
     let decipher = createDecipheriv("aes-256-ctr", key, iv)
diff --git a/cw/src/utils.ts b/cw/src/utils.ts
index e6143bf..d840411 100644
--- a/cw/src/utils.ts
+++ b/cw/src/utils.ts
@@ -46,7 +46,9 @@ export function registerRecvBuffer(conn: Socket) {
 
 export const writeEncUB = async (conn: Socket, cipher: Cipher, d: any) => {
     // console.log("enc writes:", ++writes)
-    await writeUB(conn, cipher.update(d))
+    const b = cipher.update(d)
+    console.log("enc write: ", b)
+    await writeUB(conn, b)
 }
 
 export async function waitForDataUB(s: Socket): Promise<Buffer> {
@@ -64,7 +66,9 @@ export async function waitForDataUB(s: Socket): Promise<Buffer> {
 export async function waitForEncDataUB(s: Socket, decipher: Decipher) {
     // console.log("enc reads:", ++reads)
     const eData = await waitForDataUB(s)
+    console.log("encrypted recv ", eData)
     const decData = decipher.update(eData)
+    console.log("decr data ", decData)
     return decData
 }
 
-- 
GitLab