Can encrypt ConnectionString in web.config on the development machine and deploy to the server?

I am going to encrypt the connection string in web.config using the aspnet_regiis.exe tool.

You do not know how the decryption string is decrypted on the server, so ask wana, if I encrypt on my development machine and deploy to the server, will it work? Or should it be encrypted on the same machine where it will be executed?

+4
source share
1 answer

If you use the aspnet_regiis.exe tool, you will need to do this on each server separately, because the encryption married the server on which the encryption key was generated. So the short answer is that if you use this method, your DEV key will not work when deployed to other environments.

However, if you want to be able to encrypt on one server and deploy it on other servers, reusing the same key, you need Encrypt Configuration Sections in ASP.NET 2.0 Using RSA . This works because you can export RSA keys. This method is especially useful in web farm scenarios (i.e., multiple front-end web servers).

+6
source

Source: https://habr.com/ru/post/1501754/


All Articles