diff --git a/cw/src/client.ts b/cw/src/client.ts index 2a7b8404de1d72c5eb830f0e3cb2e95967fe4dea..12f2a261309a88a363cf69cc56e51dbd8e186a3f 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 e6143bf3f440fb516afad650a40088a6108a5fcc..d840411320f9a7891a60a5db4d480f271148849c 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 }