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

前端 未结 9 1667
醉梦人生
醉梦人生 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 13:15

    Since you must send the password in unencrypted form over the network, there is nothing you can do to protect it 100%.

    AES is good enough if you need to store locally, and talking about disasms, network sniffers etc is not particulary good contra-argument becuase the same thing can be done with any program (sure, ASM is harder then CIL but its a minior point).

    Such password protecting is good enough to prevent casual pick up, not to prevent decoding by proffesionals.

    0 讨论(0)
  • I am assuming that you want to encrypt the password as it will be on the users machine and they will (possibly) be able to find it and use it? If so you are basically screwed - no matter what you do, since it is in the users domain they will be able to get it and figure out the encryption and get the password for the encryption (remember that using Reflector - and it's clones - isn't out of the reach of most) and decrypt it and they have it. In short all you are doing is obfuscating the password, not securing it.

    What I would recommend is actually move it out of the users control. For example put up a web service which communicates with the client and returns the password securely when requested. This also allows you to change the password, if needed in future as well as provides you with a way to validate legitimate users.

    0 讨论(0)
  • 2021-02-12 13:17

    One of the most important thing is the permissions on the file. Even if the content is encrypted you need to make sure that only the processes that need access to the file can read it.

    0 讨论(0)
提交回复
热议问题