Best practices for encrypting and decrypting passwords? (C#/.NET)

前端 未结 9 1665
醉梦人生
醉梦人生 2021-02-12 12:26

I need to store and encrypt a password in a (preferably text) file, that I later need to be able to decrypt. The password is for another service that I use, and needs to be sent

9条回答
  •  梦谈多话
    2021-02-12 12:56

    System.Security.Cryptography.ProtectedData in the System.Security assembly uses some Windows APIs to encrypt data with a password only it knows.

    One possibly use of this would be to have a Windows service that actually does the operation requiring the password. The application that the user interacts with calls into the service via remoting or WCF. As long as the service used DataProtectionScope.CurrentUser and the service user is different from the logged on user, the password should be pretty safe.

    This of course assumes that the users are running as limited users who cannot modify the service or run program as the service's user.

提交回复
热议问题