如何存储和从PIN /密码验证随机选择数字 [英] How to store and verify digits chosen at random from a PIN/Password
问题描述
如果我有一个用户的6位PIN码(或n字符的字符串),我想确认说,3位随机从PIN(或X字符)作为登陆过程的一部分选择,我将如何保存PIN在数据库或以这样的方式有些加密/散列密码的版本,我可以验证用户身份?
If I have a users 6 digit PIN (or n char string) and I wish to verify say 3 digits chosen at random from the PIN (or x chars) as part of a 'login' procedure, how would I store the PIN in a database or some encrypted/hashed version of the PIN in such a way that I could verify the users identity?
思考:
- 店铺的PIN码可逆
(对称或不对称)加密的方式,解密数字检查。 - 店铺的范围内的PIN对一些散列排列
ID,它链接到随机
数字'选择,例如:- ID:数字1,2,3 123 =散列
- ID:数字4,1,6 416 =散列
- Store the PIN in a reversible (symmetrically or asymmetrically) encrypted manner, decrypt for digit checks.
- Store a range of hashed permutations of the PIN against some
ID, which links to the 'random
digits' selected, eg:
- ID: 123 = Hash of Digits 1, 2, 3
- ID: 416 = Hash of Digits 4, 1, 6
问题:
- 键安全:假设关键是
保护与该应用程序是不是
金融也不非常关键,但
是大批量。 - 创建
哈希宽数数
排列既令人望而却步
高存储(16字节点¯x数
排列)和耗时的可能是矫枉过正
是否有任何其他选项,问题或改进?
Are there any other options, issues or refinements?
是:我知道,存储密码/ PIN码以可逆的方式是有争议,最好不应该做的。
Yes: I know storing passwords/PINs in a reversible manner is 'contentious' and ideally shouldn't be done.
只是为了澄清:
1.随机数字是我正在考虑,以避免按键记录程序的方案。
2.这是不可能试图比重的有限数目。
3.其他因素帮助安全和访问进行身份验证。
Just for clarification: 1. Random digits is a scheme I am considering to avoid key-loggers. 2. It is not possible to attempt more than a limited number of retries. 3. Other elements help secure and authenticate access.
推荐答案
- 的关键是'保护'
- 的应用程序是不是金融,也不具有高
关键 - 的应用程序是高容量。
- 创建哈希宽数数
排列既令人望而却步
高存储(16字节点¯x数
排列)和费时
可能是矫枉过正 - 随机数字是一个方案,我
考虑到避免按键记录程序。 - 这是不可能尝试更
比重试的数量有限。 - 其他要素帮助安全
访问进行身份验证。
您似乎主张存储在清澈的PIN。我说去了。你基本上是描述一个挑战 - 响应的验证方法,在服务器端存储明文对于那些用例常见的。
You seem to be arguing for storing the PIN in the clear. I say go for it. You're basically describing a challenge-response authentication method, and cleartext storage on the server side is common for that use-case.
类似的东西来,这是一个一次性衬垫,或秘密密钥矩阵。所不同的是,用户必须保持/与他们的垫来访问。这样做的好处是,只要你拿到钥匙分发足够安全,你从键盘记录器非常安全的。
Something similar to this is a one-time-pad, or a secret key matrix. The difference is that the user has to keep / have the pad with them to access. The benefit is that as long as you get the key distribution sufficiently secure, you're very safe from keyloggers.
如果你想这么矩阵/垫的暴露不会导致孤独妥协,让用户使用短(3-4号)引脚与焊盘,并保持你的敏感锁定机制。
If you want to make it so that exposure of the matrix / pad doesn't cause compromise alone, have the user use a short (3-4 number) PIN with the pad, and keep your sensitive locking mechanism.
矩阵的例子:
1 2 3 4 5 6 7 8
A ; k j l k a s g
B f q 3 n 0 8 u 0
C 1 2 8 e g u 8 -
一个挑战可能是:请输入您的PIN,然后角色从你的矩阵广场B3。
A challenge might be: "Enter your PIN, and then the character from square B3 from your matrix."
的响应可能是:
98763
The response might be: 98763
这篇关于如何存储和从PIN /密码验证随机选择数字的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!