加密 appConfig configSection c# 的部分
我有服务器设置的自定义配置部分,其中包括:服务器的用户名、密码和IP;我需要获得这种类型的加密配置:
<ApplicationServerConfiguration>
<Server UserName="ASDASDASDASDAS [Some encrypted value] ASDASDASF"/>
<Server Password="ASDASDASDASDAS [Some encrypted value] ASDASDASF"/>
<Server ServerAddress="192.168.255.255"/> **Not encrypted value!**
</ApplicationServerConfiguration>
我可以加密整个 configSection,但不能加密其中的一部分。谁知道如何仅加密 configSection 的部分内容?
I have custom config section with Server settings, which includes: username, password and IP of the server; I need to get encrypted config with this type:
<ApplicationServerConfiguration>
<Server UserName="ASDASDASDASDAS [Some encrypted value] ASDASDASF"/>
<Server Password="ASDASDASDASDAS [Some encrypted value] ASDASDASF"/>
<Server ServerAddress="192.168.255.255"/> **Not encrypted value!**
</ApplicationServerConfiguration>
I can encrypt whole configSection, but not part of it. Who knows how to encrypt just parts of configSection?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
您可以手动加密和解密它们
You could manually encrypt and decrypt them
不可能只加密部分的一部分。如果您希望能够加密用户名和密码值,则必须将它们放入单独的部分。
It is not possible to encrypt only part of a section. You will have to put the UserName and Password values into a separate section if you want to be able to encrypt them.
App.config
根本不是存储安全凭证的好地方!The
App.config
isn't a good place at all to store security credentials!