Ways around putting a password in code

后端 未结 3 592
梦毁少年i
梦毁少年i 2020-12-31 18:16

I have a bit of code that needs to run with elevated privileges (more that I want the rest of my code running at).

I have my code that sets up the Impersonation work

3条回答
  •  抹茶落季
    2020-12-31 18:48

    Vaccano,

    I would recommend investigating the data protection API (DPAPI) for what you're attempting to achieve. It is considered part of the solution in many best practice approaches to reversibly storing passwords needed by applications.

    A good article discussing the DPAPI (and other techniques + concerns) can be found here:

    http://msdn.microsoft.com/en-us/magazine/cc164054.aspx

    With C# 2.0, P/Invoking isn't even required; managed wrappers exist:

    http://blogs.freshlogicstudios.com/Posts/View.aspx?Id=41ca5a99-ddc0-4d0a-9919-2ce10bf50c7e

    I hope this helps!

提交回复
热议问题