Question: I am currently working on a simple WinForms/C# application which archives data in a structured and consistent manner. The intended users don't have write access to the archive folder, and are only supposed to be able to write using the application.

Since users should not get additional rights, I need to supply the application with the credentials of some generic service user in order to start user impersonation. Because the users are not supposed to know those credentials, they would have to be stored somehow (I'd prefer locally since I have no experience using databases and whatnot).
Is there any way to securely store the credentials without the end user having to know/do anything about them? Or is there another, better way to go about solving this problem?

I know that questions about password storage are frequent, and I have tried my best to find an answer to my specific problem, but all of the threads I could find are looking to store a password known by the user.

Answer: 
The safest solution is to actually create a service, which runs under a user with the correct permissions. Your Winforms application would then just use a tight interface to the service to tell it what needs to be done. How feasible this is depends on what exactly you're trying to do.

Trying to do this using just the winforms application is tricky. If a user application can do something, so can the user. Remember, there's no such thing as "application permissions" - only user permissions. The GUI application will run as *some* user, and that user can do everything the application can.
you can hash passwords like below

```
using System.Security.Cryptography;

public static string EncodePasswordToBase64(string password)
{  byte[] bytes   = Encoding.Unicode.GetBytes(password);
   byte[] inArray = HashAlgorithm.Create("SHA1").ComputeHash(bytes);
   return Convert.ToBase64String(inArray);
}

```