6 ms·
The reason for multiple AES keys is because the gps points are optionally password protected, but I didn't want to save the password anywhere on the file system
by conroe64 14y ago
The reason for multiple AES keys is because the gps points are optionally password protected, but I didn't want to save the password anywhere on the file system, and I wanted the app needs to be able to store and encrypt points after a reboot without forcing the user to reenter their password.
I solved this issue using a pair of RSA public/private keys that are stored in internal storage. The private key is then encrypted by the password whereas the public key is not. So what happens is that on reboot, a random AES key is created, encrypted by the public RSA key and stored in a table. Then, this is used to encrypt any future GPS points until a further reboot. (I didn't want to use the RSA key directly due to efficiency concerns and the lack of a good padding mechanism within the library)