I am looking into storing some sensitive data in an application I am working on. I have been looking at the ProtectedData
class provided by Microsoft, and it looks pretty straightforward. However, I have a couple of questions regarding how it works.
First, I see that it uses "the user's login credentials" to generate the encryption key. I have seen in the documentation that only the current user will be able to decrypt the data. That is not a problem, I just want to know if the same user is logged in on a different machine, will they be able to decrypt the data? I am planning to have the saved information being shared over OneDrive, so hopefully it would be accessible on any device that the same user is using.
ex:
User A logs in on desktop computer, saves encrypted file abc.txt
User A then logs in on tablet, loads file abc.txt
Is abc.txt
accessible to User A on the tablet?
Second, what happens once the user changes their password? It seems to me that the encryption key would then be different, and wouldn't that cause the decryption of the data that used the previous encryption key to no longer be recoverable?
ex:
User A logs in on desktop computer, saves encrypted file abc.txt
User A changes password
User A logs in on desktop computer, loads file abc.txt
Is abc.txt
accessible to User A anymore??