4

我目前正在开发一项要求用户选择 4 位密码/pin 的服务,因为它是一项移动服务。我正在使用 256 或 2048 位加密对这些密码进行加密,并将对其进行哈希处理。账号输错4次后被封,只能手机输入。破解这些 PIN 会很难吗?我问这个是因为敏感信息正在被存储。数据库连接到 Web 应用程序,应用程序使用 twilio 加载到手机。我最害怕的是数据库正在通过网络被黑客入侵。什么是保护敏感数据安全的好方法?

4

5 回答 5

6

If someone gets hold of the database, you would be pretty much screwed:

If you just encrypt the 4-digit passwords, an attacker can just build a table of the 10000 possible encrypted strings and can trivially decrypt the PINs.

If you use salt strings (and encrypt not PIN, but PIN+salt and store crypted(PIN+salt) alongside with salt), people have to make a per-password effort, but there are still only 10000 possibilities for each password (which is not very much).

Which means, yes, by all means you should keep the database off the web. (If the web application is only ever accessed through twilio, you can reject connections from any other IP range).

于 2011-06-12T16:21:59.760 回答
2

由于您使用的是 twilio,因此只需确保 twilo 仅使用安全协议与您的 Web 服务对话,并拒绝您不确定来自受信任来源(即 twilo)的任何请求。根本不需要别针。

这是一个关于如何在 Web 服务器和 twilo 之间设置 ssl 的巨大网页。它甚至有一个 php 示例。 http://www.twilio.com/docs/security

于 2011-06-12T18:37:35.647 回答
2

如果您使用 PKCS#1 1.5 或 2.0 RSA 加密(查看标准),您还将加密随机填充。这意味着在传输过程中,只要填充是保密的并且是真正随机的(这不是应该公开的盐),就无法比较 PIN。

至于数据库,最好尽可能将其移出正常操作。创建一个简单的服务,在解密后只检查 PIN,确保没有缓冲区溢出等,如果可能,使用与生产服务器不同的机器和访问权限。好好测试这部分,接口小,应该不难。

如果您和手机都能做到这一点,您可能想尝试 ECC,但这不适合温顺的人。RSA 加密通常使用一个小的公共指数(强烈建议使用 0x010001),因此它比手机的 ECC 更快。在服务器上(以及在创建密钥期间)ECC 速度要快得多。我不会为此推荐对称加密(AES/3DES)。

哦,在应用程序中包含公共加密密钥(用于隐式信任),不要从服务器发送它。将私钥保密,除已提及的服务外,其他任何内容都无法访问。

于 2011-07-14T01:53:41.687 回答
1

The interface you describe sounds secure to me. It's secure enough for ATMs!

Are the encrypted PINs easy to crack? Yes, there's only 10000 possible combinations and a rainbow table can be generated of all the possible encrypted values unless you salt. However that would require access to the encrypted PINs which means the attacker already has a copy of your database.

So really you need to ensure your database server is secure. There's a lot of variables that could make it insecure so it's a big question. Instead you could rely on third-party solutions like Amazon S3 or others and concentrate on coding instead of security. Let them do the hard work!

于 2011-06-12T16:26:59.507 回答
0

您应该使用优质的密码加盐技术来防止密码被盗。查看维基百科文章以了解有关盐渍的更多信息。盐条

于 2011-06-12T16:21:32.453 回答