如何在 Windows 窗体应用程序中隐藏连接字符串 [英] How to Hide connection string in windows forms application

查看:35
本文介绍了如何在 Windows 窗体应用程序中隐藏连接字符串的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

你们知道exe文件中的硬编码可以很容易地通过一些软件(例如代码反射器)看到,我想知道我是否可以隐藏我的连接字符串,其中包含要连接的sql server用户名和密码信息Windows 窗体应用程序中的数据库不会通过任何代码反射器被看到,以便除我之外的任何人在未经我许可的情况下永远无法使用我的应用程序.

as you guys know that the Hardcoded coding in exe file can easily be seen through some Softwares (e.g. code reflector), I want to know whether how can I Hide my connection string having information of sql server username and password to connect to database in windows forms application from being seen through any code reflector so that any one else Except me may never be able to use my application without my permission.

推荐答案

正如所评论的,您最好使用集成安全性,但是如果您的目标是具有混合模式身份验证的 SQL Server,您可以使用数据保护 API 进行加密app.config 中的连接字符串.这是一篇关于该主题的精彩文章:

As commented, you are better off using Integrated Security, however if you are targeting a SQL Server with say Mixed Mode Authentication you could use the Data Protection API to encrypt the connection string in the app.config. Here is a great article on the topic:

保护应用程序机密,例如数据库连接字符串和密码,需要仔细考虑一些相关的诸如数据的敏感程度、谁可以访问它,如何平衡安全性、性能和可维护性等等向前.本文解释了数据保护的基础知识和比较可用于保护的各种技术应用程序设置.作者讨论了要避免的内容,例如在源代码中隐藏密钥和使用本地安全机构.在此外,他还提出了一些有效的解决方案,例如数据保护 API.

Protecting application secrets, such as database connection strings and passwords, requires careful consideration of a number of pertinent factors such as how sensitive the data is, who could gain access to it, how to balance security, performance, and maintainability, and so forth. This article explains the fundamentals of data protection and compares a variety of techniques that can be used to protect application settings. The author discusses what to avoid, such as hiding keys in source code and the use of Local Security Authority. In addition, he presents some effective solutions such as the Data Protection API.

保护代码中的数据库连接字符串和其他敏感设置

如何:使用 DPAPI 加密和解密数据 (C#/VB.NET)

这篇关于如何在 Windows 窗体应用程序中隐藏连接字符串的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆