How to encrypt ConnectionString for Entity and Windows Forms

I am writing a Windows Forms public distribution application that uses a cloud database. I need to encrypt the connection string in the published app.config file. I am using Entity Framework and .net 4.5 for this project. From what I read (and this may be wrong), EF does not automatically decrypt connection strings. How to do it?

+4
source share
2 answers

You must use Windows Authentication. If you give users an encrypted connection string and expect them to send it back unencrypted, then you must provide them with the means to decrypt the mostly public key, which is security, no. Perhaps you can encrypt the string in the file and transfer the application to the WCF or REST service, which stores the private key, decrypts, establishes a connection to the database and makes a request to the database. But that still makes the encrypted value as good as the password. This is why you need to use Windows authentication so that the user can provide their credentials, and you allow them. This way you can control who accesses the database and the user is the only personhaving access to their password (theoretically one way or another).

ASP.Net , WinForm ASP.Net , , .

0

, , aspnet_regiis. app.config web.config, ,

/ App.config,

.

-2

All Articles