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. user can encrypts and decrypts any message, no matter who sent it, because all users of this channel have the same keys.
Any other ideas?
Note: I am required to use AES encryption but not deffie hellman, so is there another algorithm better than deffie hellman to do this?