# How do single use passwords work for an encrypted message

LastPass encrypts its data before sending it to their servers. The key for the data is generated using a combination of the master password and username.

How then can a one-time password be used to decrypt this data? The data on the server has been encrypted with the master password and username. Does this mean that LastPass stores a new version of encrypted data for every (single-use) password?

-
They key for the data should be generated in a way that also involves salt. $\hspace{2.2 in}$ (I have no other reason to believe that it actually is.) $\:$ –  Ricky Demer Jan 12 at 19:18

As hunter notes, the only people who can really say what LastPass actually does are those who work there. However, as long as we only consider what they can and should do...

They don't really need to store a separate copy of your data for each one-time password. Instead, all they need to store for each password is an encrypted copy of the key used to actually encrypt the data.

So, when you log in using a one-time password, the password is (presumably) passed through PBKDF2 to derive a "key-encryption key", which is then used to decrypt the actual key needed to decrypt the data.

-
thanks for the insight - this solution makes much more sense than cloning the data. LastPass states on their website that "LastPass utilizes the PBKDF2 function implemented with SHA-256 to turn your master password into your encryption key". Strictly speaking, assuming that they implement the system you've described above, then the hash of the user password is not actually the resulting encryption key, but rather an intermediate key to decrypt the final key. –  hunter Jan 15 at 16:24
@hunter: I suppose they might derive the actual encryption key directly using PBKDF2 from the user's permanent password, and then save an encrypted copy of that key for each one-time password. Or the statement on the website might just be missing some details. –  Ilmari Karonen Jan 16 at 2:48