且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

.net桌面应用程序中的连接字符串安全

更新时间:2023-02-03 08:33:42

我不认为以任何方式掩盖密码将会解决你的问题。如果用户必须将密码发送到服务器,并且密码位于该框上,则根据定义,运行应用程序的用户必须具有对该密码的访问权限并能够对其进行解密。否则,您将无法对其进行身份验证。这意味着,无论您在何处存储,都将始终有一种方式让用户获取密码。

I don't think that encyrpting the password by any means is going to solve your problem. If the user has to send the password to server, and the password is located on the box, then by definition the user running the application must have access to the password and be able to decrypt it. Otherwise, you wouldn't be able to authenticate them. This means that there will always be a way for the user to get at the password, regardless of where you store it.

我可以想到可能有两种方式可以工作,但我恐怕他们不完全是你要找的。​​ p>

I can think of 2 ways that could possibly work, but I'm afraid they're not exactly what you're looking for.


  1. 删除使
    用户通过使用某种本地代理
    向服务器
    发送密码的要求(例如使用WCF Windows
    服务)来获取您的winform
    请求,然后将它们以
    的形式发送给DB服务器。如果您使用
    安装使用与用户帐户不同的帐户
    的服务,则
    那么您可以通过其他
    答案中提到的任何方式来保护密码
    。他们的关键在于使
    确保应用程序用户不
    可以访问
    的资源,服务帐户需要解密
    密码。

  2. 不要将密码存储在Web配置中。在数据库级别为每个用户分配不同的用户帐户和密码,并在登录时将它们键入。