I am developing a client server application in which data is transferred between two clients through the server.
The data should be encrypted and I thought of using AES. My thought was to use PBKDF2 in order to derive the AES key from the client's password.
In this case the client will encode the data, the server will decode it, reencode it using the 2nd client's password and send it to the 2nd client.
Do you think this is the best way to implement this?
Is there a way for the first client to encode and the 2nd client to decode without server interference?
How can I encrypt the AES key and transfer it from one client to the other?
What do you think of the following solution?
- Client and server create a private AES key using Diffie-Hellman (this key is specific to each client).
- Transmitting client creates a session AES key and encodes it using the private AES key.
- Server decrypts the session key and re-encrypt it for every client in the session (using each client's private key).
- Transmitting client encrypts the data using the session AES key and sends it to the server.
- Server sends the data to all recipient clients without any required processing.