简体   繁体   English

加密类库app.config文件

[英]Encrypting class library app.config file

Please share your thoughts if there is any way to encrypt app.config section with out changing code? 如果有任何方法可以在不更改代码的情况下加密app.config部分,请分享您的想法? I know that we can use aspnet_regiis.exe to encrypt the web.config file. 我知道我们可以使用aspnet_regiis.exe来加密web.config文件。

I came across some blogs to rename app.config to web.config and run aspnet_regiis -pef command. 我遇到了一些博客,将app.config重命名为web.config并运行aspnet_regiis -pef命令。 I am able to create an encrypted version of app.config file but application failed to read the keys from encrypted app.config. 我能够创建app.config文件的加密版本,但应用程序无法从加密的app.config中读取密钥。 so this approach didnt work for me. 所以这种方法对我没有用。

Many thanks 非常感谢

What about this way? 这个怎么样? Are you able to do that? 你能做到吗?

  1. Encrypt your connection strings and stored procedure names in app.config. 在app.config中加密连接字符串和存储过程名称。 (Use like tripleDes) (使用类似TripleDes)

  2. Store your encrypted values in app.config.(like: ConnectionString="asdasfasfasfdsdgsdfa") 将加密值存储在app.config中。(例如:ConnectionString =“asdasfasfasfdsdgsdfa”)

  3. After reading value from app.config, decrypt it with your service and use. 从app.config中读取值后,请使用您的服务对其进行解密并使用。

by the way I found my old answer about ready to use Crypto Class :) 顺便说一下,我找到了有关准备使用Crypto Class的旧答案:)

.NET: what are my options for decrypting a password in my project .setting file .NET:我在项目.setting文件中解密密码有哪些选择

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM