log4net 对配置的ConnectionString 进行加密
时间:2011-05-31 来源:风云8
下载源码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的配置节点的敏感数据进行加密
相关阅读 更多 +