首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >与服务器的安全连接mysql -C#

与服务器的安全连接mysql -C#
EN

Stack Overflow用户
提问于 2014-10-12 20:44:05
回答 1查看 94关注 0票数 0

我对数据库的安全连接有疑问。我使用app.config文件建立了与MySql数据库的连接,并在其中输入了数据服务器、数据库和用户密码。所谓的connectionString。安全吗?

请帮助,并有任何提示或任何好的材料。

示例代码:

代码语言:javascript
复制
<connectionStrings>
    <add
        name="MyDBConnectionString"
        connectionString="NameServer.info; User Id=NameUser; Persist Security Info=True; database=DatabaseName; password=Pass"
        providerName="MySql.Data.MySqlClient"
    />
</connectionStrings>
EN

回答 1

Stack Overflow用户

发布于 2014-10-12 21:49:37

您应该对存储在配置文件中的Connection Strings进行加密。

使用位于以下位置的aspnet_regiis.exe :开始-> Visual Studio -> Visual Studio工具-> Visual Studio命令提示符

运行以下命令:

代码语言:javascript
复制
aspnet_regiis –pef connectionStrings c:\PathToWebSite

如果上述命令不起作用,请尝试

代码语言:javascript
复制
aspnet_regiis -pe connectionStrings -app "/" -site n

其中n是IIS中报告的网站的站点ID。

现在,如果您的Connection String部分将被加密:

代码语言:javascript
复制
<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>

有关详细信息,请访问:

票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/26325264

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档