Me and my team is developing a multiplayer videogame with a Client/Server-Topology. This secures the match from clients who have the intention to cheat because of server authority but still allows the server to modify outgoing and incoming packets as well as sensible user data of the players.
We chose to use AES as the encryption method, but had the problem of informing all peers about the used key to secure the network-packets with this encryption method.
I read into the Diffie-Hellman-Merkle key exchange algorithm which worked perfectly between two peers (Alice and Bob how they are called in the examples). The problem is that our game allows matches with a variable number of players, ranging from 2 to 16.
The condition seems to be that every client needs to generate the same number b (exponent of g) to share its equation result with the server, so that both have the same result which is s.
I have no clue how to generate a secret key on every peer, if the time at which clients connect and the number of connections over the match are variable.