Support a Handshake Message
0) Client requests a handshake via a knock message
1) Server replies with a KnockKey that is an SSL Public Key encrypted with server's public-private key.
a) Server generates a KnockKey using the client's IP address and some RND value with a value to indicate how long the key is valid for.
b) Server stores the private key into the database under the IP address, expiresAt, key.
c) Server sends the public KnockKey
2) Client receives KnockKey and decrypts reply using the server's public key.
a) Reply has status (Handshake::Success or Handshake::OutDated)
Ideas: https://github.com/QuasarApp/Qt-Secret https://evileg.com/en/post/496/
https://cpp.hotexamples.com/examples/-/-/RSA_private_decrypt/cpp-rsa_private_decrypt-function-examples.html https://stackoverflow.com/questions/17400058/how-to-use-openssl-lib-pem-read-to-read-public-private-key-from-a-string https://www.oreilly.com/library/view/secure-programming-cookbook/0596003943/ch07s06.html
https://sandilands.info/sgordon/public-key-encryption-and-digital-signatures-using-openssl
Edited by John Schneiderman