关于在web.config文件中加密密码的快速问题。
所以我在web.config中加密了3个密码(感谢)
How to decrypt a connectionString in a web.config using regiis_asp.net?
使用命令
aspnet_regiis.exe -pef "connectionStrings" C:\path\to\application
然后,我可以使用以下方法解密并访问代码中的密码:
var password1 = "";
var password2 = "";
var password3 = "";
var section = System.Web.Configuration.WebConfigurationManager.GetSection("secureAppSettings") as NameValueCollection;
if (section != null && section["password1"] != null && section["password2"] != null && section["password3"] != null)
{
password1 = section["password1"];
password2 = section["password2"];
password3 = section["password2"];
}
我的问题是……只复制新创建的加密标签(在运行encrypt命令后创建)可以吗
<secureAppSettings>, <EncryptedData>, <EncryptedKey>...<CipherData>...<CipherValue> etc etc..
从本地webconfig,并将它们添加到临时服务器和实时服务器中的webconfig。。。。或者我应该将新的应用程序设置密码字段添加到暂存和实时web配置中,然后运行相同的命令
aspnet_regiis.exe-pef“connectionStrings”C:\path\to\application
在暂存/直播时对它们进行加密。。。而不是仅仅复制新字段
还是重要?
谢谢你的建议