Using C# and .NET 4.5:
I am looking for a simple and efficient option to use the windows user and current machine to encrypt/decrypt a string.
The encrypted string can be decrypted on the very same machine with the same logged-in user only.
Other users logged-in to the same machine must not be able to decrypt. The same user logged into another machine must not be able to decrypt.
Back in 2002, I used to use DPAPI to do the similar thing. I expect there is a more modern option in 2016 with .NET 4.5 with single line of API call :)
Update 1:
Based on @Jeroen Mostert response, I understand that DPAPI wrapper class ProtectedData is still relevant.
My question is which one of the following statements is correct in regards to DPAPI? I hope the correct answer is C since that is what I am looking for.
A - DPAPI only uses the current User identity the encryption key
B – DPAPI only used the current machine as the encryption key
C- DPAPI used the current user and the current machine as the encryption key (A and B)
Thank you,