I need to store credentials for my app.
Mmmhmmm.
I've read it's a very bad practice to store them with code.
Not "with code", but in code: i.e. as string literals baked into your executable.
I know, DPAPI is just made for it
Yup.
but how to use it on Linux like Ubuntu?
With difficulty.
So - if I could make DPAPI work on Linux without spending whole day on it - it would be my first choice.
You can't. DPAPI is a Windows thang.
Then it's poor man's security - a file on target machine. So - not with the source
At least on Linux you can take advantage of the far simpler filesystem security model to secure files from access by other users without too much effort (i.e. chmod
, compared to Windows where you need to faff around with DACLs (caveat: DACLs are still objectively far,far superior to chmod
. Consider using SELinux to get DACLs outside of Windows).
The file is in a directory only the admin can access, so it's as secure as the host itself.
Debatable.
Tell me why the file is bad? ;)
I can't. You haven't told us anything about the file.
Better solution: take advantage of any available hardware TPM to store encryption keys: https://wiki.archlinux.org/index.php/Trusted_Platform_Module