I am creating a chat app. This app contains private messages and channels. These channels include more than one user.
I want to encrypt messages using AES and to transfer the AES key to users of this channel.
I need a secure transport channel so I used Diffie Hellman. The problem now is how will I get users to generate the same Diffie Hellman keys so that I can create a shared key which will be the AES encryption key? I have learned the encryption, but between a sender and a receiver only, but here I have more than one sender and more than one receiver.
I had an idea, to make for all users who share the same channel, the same public and private key. Any user who opens the channel takes the public key from the channel and with his own keys he generates the shared key which forms the AES key. A user can encrypt and decrypt any message, no matter who sent it because all users of this channel have the same keys.
Any other ideas?
Note: My teacher has restricted me to use either AES encryption or Diffie Hellman, so is there another algorithm better than Diffie Hellman to do this?