While it's more efficient to encrypt the actual messaging between clients using symmetric encryption, it's necessary to first communicate the session key (the Secret Address Generation Algorithm code) for this using an asymmetric cipher. The options we have for doing this with Python are PyCrypto, ncrypt and Python-RSA.
The difference between this and other examples I've published in the past is that the RSA keys and the data to be encrypted are stored in an SQLite3 application database. Therefore, the program should provide the following operations:
- getKeysFromDB() -Get RSA keys from database
- genLocalKeys() - Generate client RSA keys
- writeKeysToDB() - Write RSA keys to database
- encryptSessionKey() - Encrypt session key
- decryptSessionKey() - Decrypt session key
- writeSessionKeyToDB() - Store session key