log4net 对配置的ConnectionString 进行加密

下载源码log4net

在AdoNetAppender.cs 文件下的m_dbConnection.ConnectionString = m_connectionString 进行解密的函数如:加密config一样

 

// Set the connection string
                ShareSafePassword.CRM log4safe = new ShareSafePassword.CRM (); //解密类
                if (m_connectionString != null && m_connectionString != "")
                {
                    m_connectionString = log4safe.DecrypWebConfig(m_connectionString);//实现解密
                }
               
    m_dbConnection.ConnectionString = m_connectionString;

    using(SecurityContext.Impersonate(this))
    {
     // Open the database connection
     m_dbConnection.Open();
    }

即可实现将配置log4net的配置节点的敏感数据进行加密

转载于:https://www.cnblogs.com/zhbsh/archive/2011/05/31/2064960.html

你可能感兴趣的:(log4net 对配置的ConnectionString 进行加密)