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 目录下配置文件,你就会发现已经加密了。。。。

  • 相关阅读:
    C++中左移<<的使用
    学会构造素数序列
    有关lower_bound()函数的使用
    Codeforces Round #166 (Div. 2)
    暴力swap导致TLE问题解决办法
    memset的正确使用
    Codeforces Round #297 (Div. 2)
    Codeforces Round #170 (Div. 2)B
    Codeforces Round #176 (Div. 2)
    C/C++ sort函数的用法
  • 原文地址:https://www.cnblogs.com/feima218/p/1250749.html
Copyright © 2011-2022 走看看