Hot answers tagged

2

I managed to find it out by reproducing the test vectors. TL;DR: The standard assumes that you use the low 4 bits of the last byte of the hash, regardless of its length. So replace 19 in the original DT definition with 31 for SHA-256 or 63 for SHA-512 and you are good to go. Finding this out wasn't completely straightforward, as the standard only has a ...


2

I had only a quick read through the source, and I am not particularly fluent in C#, so I may have gotten something wrong. That said the process appears to be: Generate a random encryption key, encrypt the database with it. Generate (up to six) HOTP tokens, derive a key from those, use that to encrypt the database key. To read: Ask for the HOTP tokens, ...


1

As mentioned by SEJPM in the comments, four bytes is much too short for an HMAC key. Since KEY_SECRET is already in place, you could just use it directly as a MAC key, but then you need to make sure that DATA cannot collide with any counter value. You could do this by prefixing DATA with enough constant values to make it longer than the counter. For ...


1

Yes, that's fine where TOTPs are generated in accordance with RFC 6238; this is because the time is combined with the secret before generating the HMAC. This means that it isn't practically possible to derive the time (or information about it, such as the time difference) based on the key alone because of the Avalanche effect in the hashing algorithm that is ...



Only top voted, non community-wiki answers of a minimum length are eligible