Replies: 3 comments 7 replies
-
Try encrypting the file using ProtectedData class with optionalEntropy maybe? |
Beta Was this translation helpful? Give feedback.
-
The discussion at #1840 predates this one and struggles with the same use-case. |
Beta Was this translation helpful? Give feedback.
-
We recently experimented with this ourselves for another purpose. You can create an ACL that has a "conditional ACE" in it that only allows access if the calling process is part of a package. See https://stackoverflow.com/questions/63455546/whats-exists-win-sysappid-condition-in-c-program-files-windowsapps-acl for an explanation of the mechanism. I'll have to sanitize the code a little, but the mechanism was:
This ensures that only your app can browse the files in that directory. Note, however, that the user still owns the folder - the user can replace/reset the ACL using icacls or File Explorer prompting "did you want access?" ... neither should be happening on a regular customer's machine, though. We've had a bunch of conversations about how to achieve this "private app data protection" system. This is the best I've got so far, but we're working on it. What are some scenarios you'd use this mechanism for? |
Beta Was this translation helpful? Give feedback.
-
On macOS an app can store data that other apps can't access by (ab)using the password storage in the user's login keychain. The keychain service won't reveal the "password" (which can be a text encoded key) to other apps unless the user explicitly grants access, and that key can then be used to encrypt files on disk so they're not visible to other apps. Browsers use this to protect their cookie storage, for example.
It appears there's no way to do the same thing on Windows. There is the WinRT PasswordVault class which does link saved passwords to the appcontainer, but unpackaged apps can simply access all passwords instead of none as you might expect.
Is there a way to store data somewhere in Windows, via some technique, such that it's restricted to a particular package identity and the kernel will protect it as such? Maybe setting ACLs / appcontainer SIDs on a registry key? If not, it'd be nice if such an API was added. It really makes things a lot more secure, assuming of course that unpackaged apps simply subvert package identity by doing things like injecting code or controlling the address space of a packaged app.
Beta Was this translation helpful? Give feedback.
All reactions