public void RecvHandshakeRequest(Stream handshakeRequest, Stream handshakeResponse)
        {
            if (status != DhStatus.None)
            {
                throw new InvalidOperationException($"Wrong status {status}, expected: {DhStatus.None}");
            }

            BigInteger clientMod;

            using (WardenStreamReader reader = new WardenStreamReader(handshakeRequest, true))
            {
                ushort gotMark = reader.ReadUInt16();
                if (mark != gotMark)
                {
                    throw new InvalidOperationException("Handshake failed, wrong mark. Perhaps the other peer is trying to connect with unsecure connection");
                }
                int publicKeySize = reader.ReadInt32();
                publicKey = new BigInteger(reader.ReadBytes(publicKeySize));
                int clientModSize = reader.ReadInt32();
                clientMod = new BigInteger(reader.ReadBytes(clientModSize));
            }

            byte[] keyBytes = new byte[64];
            rngCsp.GetBytes(keyBytes);
            privateKey = new BigInteger(keyBytes);
            BigInteger serverMod = (privateKey * publicKey) % mod;

            commonKey = ((privateKey * clientMod) % mod).ToByteArray();

            using (WardenStreamWriter writer = new WardenStreamWriter(handshakeResponse, true))
            {
                byte[] serverModBytes = serverMod.ToByteArray();
                writer.Write(serverModBytes.Length);
                writer.Write(serverModBytes);
            }

            SetCipherKey();
        }
        public void RecvHandshakeResponse(Stream handshakeResponse)
        {
            if (status != DhStatus.WaitingForServerMod)
            {
                throw new InvalidOperationException($"Wrong status {status}, expected: {DhStatus.WaitingForServerMod}");
            }

            using (WardenStreamReader reader = new WardenStreamReader(handshakeResponse, true))
            {
                int        serverModSize = reader.ReadInt32();
                BigInteger serverMod     = new BigInteger(reader.ReadBytes(serverModSize));
                commonKey = ((privateKey * serverMod) % mod).ToByteArray();
            }

            SetCipherKey();
        }