What is the easiest way to encrypt a password when I save it to the registry?

后端 未结 12 1936
小鲜肉
小鲜肉 2020-11-30 18:13

Currently I\'m writing it in clear text oops!, it\'s an in house program so it\'s not that bad but I\'d like to do it right. How should I go about encrypting this w

12条回答
  •  谎友^
    谎友^ (楼主)
    2020-11-30 18:15

    If you want to be able to decrypt the password, I think the easiest way would be to use DPAPI (user store mode) to encrypt/decrypt. This way you don't have to fiddle with encryption keys, store them somewhere or hard-code them in your code - in both cases somebody can discover them by looking into registry, user settings or using Reflector.

    Otherwise use hashes SHA1 or MD5 like others have said here.

提交回复
热议问题