0

When Windows forms app builds, it generates a "myApplication.exe.config" file and it contains passwords. This release build will be copied to many different machines and users to use (not on a server in any way).

How do I hide these passwords from the customers?

Alex K.
  • 171,639
  • 30
  • 264
  • 288
Edgaras
  • 449
  • 3
  • 14
  • *Trivially* you can store a base64 encoded string of the encrypted password then decode & decrypt when you need to. In general there is no way to do this so that the user cannot capture the password with a little effort/know how. – Alex K. Jul 25 '18 at 14:57
  • Thanks, I only need a simple encryption, so that human would not understand when opened with a text editor. Any suggestions? – Edgaras Jul 25 '18 at 15:07
  • The ProtectedData class is simple to use https://msdn.microsoft.com/en-us/library/system.security.cryptography.protecteddata – Alex K. Jul 25 '18 at 15:09
  • Thanks Alex, If I would encrypt lets say the app.config, would my coleagues be able to edit the solution from their machines? – Edgaras Jul 25 '18 at 15:13
  • I ment the app.config – Edgaras Jul 25 '18 at 15:19
  • Checkout this link: https://weblogs.asp.net/jongalloway/encrypting-passwords-in-a-net-app-config-file – gunnerone Jul 25 '18 at 16:16
  • Possible duplicate of [Encrypt password in App.config](https://stackoverflow.com/questions/5522879/encrypt-password-in-app-config) – gunnerone Jul 25 '18 at 16:17
  • thanks gunnerone, I've already tried similar methods, If I encrypt the file in any way, then my coleagues wount be able to access it. Is there a way to just generate a .dll instead of exe.config? – Edgaras Jul 25 '18 at 16:39

1 Answers1

0

I've moved out all sensitive lines with usernames and passwords in to a seperate txt/xml file.

Created a seperate project that encrypts any text/xml file using a hard coded key.

Copied the hard coded key in to the main project.

Now the project can read encrypted text/html credentials, decrypt it, and store it in a variable and use it wherever it needs to.

Edgaras
  • 449
  • 3
  • 14