private void SendRegisterInfo(QrCodeObject qrCodeObj) { JsonRemote message = new JsonRemote(); message.PublicKey = securityManager.GetPublicKey(); string content = JsonConvert.SerializeObject(message); string strToSend = securityManager.EncryptAndEncodeMessage(content); WriteToSocket(strToSend); }
private void ManageConnectedSocket(string buffer) { string decryptedBuffer = securityManager.DecodeAndDecryptMessage(buffer); JsonRemote message = JsonConvert.DeserializeObject <JsonRemote>(decryptedBuffer); //Send the decrypted symmetric Key string decryptedContent = securityManager.DecryptContentFromHost(message.ContentToDecipher); JsonRemote jsonMessage = new JsonRemote { DecipheredContent = decryptedContent }; string content = JsonConvert.SerializeObject(jsonMessage); string strToSend = securityManager.EncryptAndEncodeMessage(content); WriteToSocket(strToSend); }