diff --git a/main.js b/main.js index 01e5166..114bfff 100644 --- a/main.js +++ b/main.js @@ -193,11 +193,13 @@ function make_encryption_key(string) var key = new Object(); // Set the varibles - key.str = string; + key.str = toBuffer(string); key.at = new Object(); key.at.rx = 0; key.at.tx = 0; + console.log("make_encryption_key:", key.str); + // Return the key return key; } @@ -255,8 +257,8 @@ function socket_init(socket, callback, ondata) console.log("Created an encryption key") // Encrypt the key with RSA - var key_encrypted = key.encrypt(btoa(sock.key.str), 'base64'); - console.log("Encrypted the key"); + var key_encrypted = key.encrypt(string, 'base64'); + console.log("Encrypted the key: ", toBytes(key_encrypted)); // Send the key to the client sock.sock.write(send_ordered(JSON.stringify({