我对数据库的安全连接有疑问。我使用app.config文件建立了与MySql数据库的连接,并在其中输入了数据服务器、数据库和用户密码。所谓的connectionString。安全吗?
请帮助,并有任何提示或任何好的材料。
示例代码:
<connectionStrings>
<add
name="MyDBConnectionString"
connectionString="NameServer.info; User Id=NameUser; Persist Security Info=True; database=DatabaseName; password=Pass"
providerName="MySql.Data.MySqlClient"
/>
</connectionStrings>发布于 2014-10-12 21:49:37
您应该对存储在配置文件中的Connection Strings进行加密。
使用位于以下位置的aspnet_regiis.exe :开始-> Visual Studio -> Visual Studio工具-> Visual Studio命令提示符
运行以下命令:
aspnet_regiis –pef connectionStrings c:\PathToWebSite如果上述命令不起作用,请尝试
aspnet_regiis -pe connectionStrings -app "/" -site n其中n是IIS中报告的网站的站点ID。
现在,如果您的Connection String部分将被加密:
<connectionStrings configProtectionProvider="RsaProtectedConfigurationProvider">
<EncryptedData Type="http://www.w3.org/2001/04/xmlenc#Element"
xmlns="http://www.w3.org/2001/04/xmlenc#">
<EncryptionMethod Algorithm="http://www.w3.org/2001/04/xmlenc#tripledes-cbc" />
<KeyInfo xmlns="http://www.w3.org/2000/09/xmldsig#">
<EncryptedKey xmlns="http://www.w3.org/2001/04/xmlenc#">
<EncryptionMethod Algorithm="http://www.w3.org/2001/04/xmlenc#rsa-1_5" />
<KeyInfo xmlns="http://www.w3.org/2000/09/xmldsig#">
<KeyName>Rsa Key</KeyName>
</KeyInfo>
<CipherData>
<CipherValue>Bf677iFrUFW ... +4n4ZZKXCTUAu2Y=</CipherValue>
</CipherData>
</EncryptedKey>
</KeyInfo>
<CipherData>
<CipherValue>UDEZ ...QfXUmM5rQ==</CipherValue>
</CipherData>
</EncryptedData>
</connectionStrings>有关详细信息,请访问:
https://stackoverflow.com/questions/26325264
复制相似问题