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

前端 未结 9 2215
时光取名叫无心
时光取名叫无心 2021-02-12 12:29

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:12

    Encrypted in AES if you must store it in a text file.

    AES is better known as Rijndael in c#

    http://www.obviex.com/samples/Encryption.aspx

    Better place would be the registry, since it would protect other users of the machine getting to it.

    Still not the best storing it anywhere that a user might be able to get to is dangerous a 1/2 way decent developer can load up your app in reflector and find your key.

    Or there is System.Security.Cryptography.ProtectedData that someone else suggested.

    The best you could do on a machine is create a certificate and encrypt/decrypt with it loaded and locked down in the machine's keystore. (Still have to deal with the certificate password being in your code)

提交回复
热议问题