In a case of using a password and get AES key using KDF to encrypt the same password (The password and the message is the same), How secure is that algorithm ?

  • $\begingroup$ No, encrypt the password $\endgroup$ – Sherif Awad Dec 2 '18 at 18:37
  • $\begingroup$ Do you mean how to remember P as K is derived from P $\endgroup$ – Sherif Awad Dec 2 '18 at 19:09
  • $\begingroup$ remembering $k$ derived from $k=KDF(p)$ $\endgroup$ – kelalaka Dec 2 '18 at 19:10
  • $\begingroup$ Why do I need to remember K? The key depends on the password, so if ihave the password, i can get the key easily $\endgroup$ – Sherif Awad Dec 2 '18 at 20:00
  • $\begingroup$ Then why you encrypt $p$? $\endgroup$ – kelalaka Dec 2 '18 at 20:02

Yes, you can encrypt every kind of information using GCM encryption, including the password used to derive the key of the scheme. There is no way that a mathematical equation can be build from that that exposes the key.

The usual caveats are of course applicable: repeating the IV could allow an attacker extract information about the password and the derived key(s), which could in turn break the confidentiality of other messages encrypted with the same key(s). So you could say it is even more brittle with regards to nonce reuse.

Brittle: it seems strong, until it crumbles.


From Wikipedia Key Derivation Function (KDF):

In cryptography, a key derivation function (KDF) derives one or more secret keys from a secret value such as a master key, a password, or a passphrase using a pseudorandom function

You have a password $p$, and you are using a KDF $k=KDF(p)$ to derive the key $k$ and then you encrypt the $p$ as $c=E_k(p)$, where $E$ is AES.

There is a problem here. How are you going to remember the $k$, if you keep the $p$, then what is the aim of encrypting it?

If you look at password manager you will see that;

Password managers typically require a user to generate and remember one "master" password to unlock and access any information stored in their databases.

One of the benefits of KDF is we input to KDF a human rememberable password to generate cryptographic keys.

You have to use some way to store the $k$ if you delete/forget $p$ and input whenever necessary. Also, $k$ is generated what is the aim of encrypting the $p$? Just delete it?

  • and remember AES-GCM is authenticated encryption mode.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.