4

I am using the PKCS#5 standard to generate a key using a random and unique salt and the user`s password in input. Consider this key as the "encryption" key.

The "encryption" key is used to encrypt a random AES key. Each users have an AES key associated to their profile.

So, a user`s profile will contains this informations:

--> password hash for authentication purpose.

--> salt used in the PKCS#5 algo. (From the PKCS#5 V2.0 documentation, we know that this information needs no protection).

--> the encrypted AES key generated randomly and encrypted with the "encryption" key generated by the PKCS#5 algo with the salt and the user`s password

I was asking myself if it is dangerous to be in possession of the password`s hash, the salt and the encrypted AES key IN THE SAME TIME. I am 99.9% sure that this is not a problem, but can it facilitates the work of an attacker being in possession of all those details?

4

1 に答える 1

3

パスワード ハッシュもソルトを使用する必要があります。そうしないと、辞書攻撃が可能になり、たまたま同じパスワードを選択した 2 人のユーザーが同じハッシュ化されたパスワードを DB に格納してしまいます。

これをお勧めします: PKCS#5 を 2 回使用するだけです。1 回はハッシュ化されたパスワードを生成するため (これは平文で保存します)、もう 1 回は暗号化キーを生成するためです (これは行いません)。

ソルトが大きく、ランダムで、独立していることを確認してください。そうすれば、パスワード ハッシュと暗号化キーの間に検出可能な関係がなくなります。結局のところ、それが塩の目的です。

[更新、少し詳しく説明]

2 つのソルト s1 と s2 を選択します。それぞれが少なくとも 64 ビットで、ランダムで、独立していることを確認してください。

空の文字列の PKCS#5 HMAC への入力としてパスワード + s1 を使用します。これが「ハッシュ化されたパスワード」です。

パスワード + s2 を PKCS#5 暗号化スキームへの入力として使用して、実際のデータを暗号化します。

ハッシュ化されたパスワード s1 と s2 をデータベースに平文で保存します。終わり。

于 2011-05-30T23:36:35.647 に答える