如何安全地包含查询字符串密码 [英] How to safely include password in query string

查看:216
本文介绍了如何安全地包含查询字符串密码的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

是否可以安全地包括在查询字符串对于C#asp.net网站的密码。

Is it possible to safely include a password in a query string for a c# asp.net site.

一些假设和东西我知道 -

Few assumptions and things I know -


  1. 网站不,不会有链接/图片/ JavaScript的/ Analytics(分析)/从其他网站。因此,没有引用链接操心。

  2. 与Web浏览器的所有通信将通过HTTPS。

  3. 我知道,查询字符串将留在的历史
    计算机。

  4. 需要的不仅仅是更多的密码/用户名登录。所以,简单地
    粘贴URL回浏览器不会导致登录。

我知道,该网站可能会受到跨站点脚本和重放攻击。我该如何缓解这些?

I know the site may be susceptible to cross site scripting and replay attacks. How do I mitigate these?

,我怎么应该包括查询字符串密码吗?

Given the above scenario, how should I include a password in a query string?

请不要问我'为什么',我知道这是不是一个好主意,但它是客户想要的东西。

Please don't ask me 'why', I know this is not a good idea, but it is what the client wants.

推荐答案

您可以放心地将密码发送到使用SSL连接的Web服务器。这种加密所有客户机/服务器之间的通信。

SSL

You can safely send the password to a web server using a SSL connection. This encrypts all the communication between the client/server.

基本身份验证协议放置在HTTP请求头中的用户/密码信息。 C#和许多其他网络服务器的语言可以访问此信息,并用它来验证该请求。当与SSL混合这是非常安全的。

Basic authentication protocols place the user/password information in the HTTP request header. C# and many other web server languages can access this information, and use it to authenticate the request. When mixed with SSL this is very safe.

如果没有以上是可能的,那么建议您为每个用户创建一个唯一的密钥。而不是送他们的密码,使用此键。的优点在于,密钥存储在数据库中,并且可以被移除。用户密码保持不变,但他们必须重新注册得到一个新的密钥。这是很好的,如果有机会的话有人会滥用他们的关键。

If none of the above is possible, then it's recommended that you create a unique key for each user. Rather then send their password this key is used. The advantage is that the key is stored in the database and can be removed. The user's password remains unchanged, but they must register again to get a new key. This is good if there is a chance someone could abuse their key.

手抖动是其中客户端向服务器发出请求,而服务器回送一个随机产生的密钥。然后,客户端产生从使用一个秘密密钥的散列,以及将其发送回服务器。然后,服务器可以检查客户端知道正确的秘密。同样的事情可以做,其中的密码是秘密而不是和客户端包括在请求中的用户名信息。这会而没有发送密码进行身份验证。

Hand shaking is where the client makes a request to the server, and the server sends back a randomly generated key. The client then generates a hash from that key using a secret, and sends it back to the server. The server can then check if the client knew the correct secret. The same thing can be done where the password is the secret instead and the client includes username details in the request. This can authenticate without ever sending the password.

如果以上都不是可能的选择,那么你可以尝试使用JavaScript之前它是通过一个开放的URL发送加密的密码。我发现了一个开源版本的 AES分组密码。该项目被称为 JSAES 并支持128至256位加密。有可能是做同样的事情其他JS库。

If none of the above are possible options, then you could attempt to use JavaScript to encrypt the password before it's sent via an open URL. I found an open source version the AES block cipher. The project is called JSAES and supports 128 to 256 bit encryption. There might be other JS libraries that do the same thing.

这篇关于如何安全地包含查询字符串密码的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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