void ReadKeyFromStream(NetworkStream stream) { if (stream.DataAvailable) { int i; if (rsaxml is null) { rsaxml = new RSAXML(); } Console.WriteLine("MODULUS: \n" + Convert.ToBase64String(rsaxml.Modulus) + "\n"); while ((i = stream.Read(bytes, 0, bytes.Length)) != 0) { symmetricKey = rsaxml.Decrypt(bytes); Console.WriteLine("Signal is: " + signal); signal = SignalByte.UNSET; } } }