I'm planning on making a chat application for fun, in C++. I just have a few questions in order to maintain forward/future secrecy across messages.
If one party is offline, but the other isn't, what do we do in this case? I've been planning on storing it in a database until the other party comes online and reads it, in which case, it's deleted from the server.
When do we regenerate the exchange? When the user's original key is lost (whether that be from uninstalling/reinstalling, corruption etc.) or another time?
How do we efficiently generate keypairs between two clients? Should we be storing the public keys in a database table, and whenever the first message is sent we use DH?
I've been planning on using AES-256-GCM once the key is derived from the DH exchange. I'm just trying to wrap my head around it all. I managed to successfully use a Diffie-Hellman exchange on my local system (albeit in RAM) but it was successful and I'm looking to branch out and expand my knowledge/experience.