zoukankan      html  css  js  c++  java
  • Cryptography Application Block

     在博客圆看到一些关于企业库的文章(可以看看这位大师写的http://terrylee.cnblogs.com/),然后自己实践了一下,发现博客中的某些地方不是很好理解,后来自己茅塞顿开了,特此记下

    添加一个组件:Microsoft.Practices.EnterpriseLibrary.Security.Cryptography.dll

     首先要加密和解密需要引入企业库中的名叫using Microsoft.Practices.EnterpriseLibrary.Security.Cryptography;

     1.介绍一下如何加密数据库连接字符串:

     private void CryptoConfig()

    {

             Configuration config = ConfigurationManager.OpenExeConfiguration(ConfigurationUserLevel.None);
                ConfigurationSection section = config.ConnectionStrings;
                 if ((section.SectionInformation.IsProtected == false) && (section.SectionInformation.IsLocked == false))
                {
                    section.SectionInformation.ProtectSection("RsaProtectedConfigurationProvider");
                    section.SectionInformation.ForceSave = true;
                    config.Save(ConfigurationSaveMode.Full);
                }

    }

    如何在查看一下,项目中bin 目录下配置文件,你就会发现已经加密了。。。。

  • 相关阅读:
    2019年春总结作业
    第十二周编程总结
    第十一周编程总结
    第九周编程总结
    第八周编程总结
    第七周编程总结
    2019春第五周作业
    2019年春季学期第四周作业
    2019年春季学期第三周作业
    2019年春季学期第二周作业
  • 原文地址:https://www.cnblogs.com/feima218/p/1250749.html
Copyright © 2011-2022 走看看