-
Notifications
You must be signed in to change notification settings - Fork 55
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Allow derivedKeyAlgorithm == 'HKDF'
for deriveKey()
#314
Comments
I agree that this would be an improvement. There's precedent for this with AES, where you can pass However, there is a (somewhat theoretical) risk of breaking backwards compatibility, since if you would (for some reason) pass And finally, it's not entirely obvious how best to get this change into the spec. The new charter of the WebAppSec WG calls for maintenance of the Web Crypto API via the WICG, e.g. by writing a separate document that monkey-patches the Web Crypto API spec. This change may be too small for that. But, if someone (maybe you?) wants to write spec text for this, and ideally some tests, and maybe even add it to the existing implementations, then I personally wouldn't be opposed to it. |
I ran into this exact issue as well... Very frustrating. |
I think there is another (similar) way - by using the hash of the primary password to derive operation key. Please correct me if I'm wrong because I plan to use this approach. |
I am no cryptography specialist but I doubt that the hash of a string of information ever has more entropy than the original string.... |
I would like to use
deriveKey
with PBKDF2 to derive a primary key from a primary password. I would then like to use HKDF to derive multiple independent operational keys (using differentinfo
parameters) from this primary key.This feels like a fairly basic setup. However, I cannot find a "proper" way to realize it after perusing the WebCrypto documentation on MDN.
Here are two possible approaches I want to avoid:
This is highly inefficient, and not an acceptable solution. PBKDF2 is, by design, costly. Needing to run PBKDF2 ten times as often will require me to reduce the iteration count by the same factor to remain within responsiveness targets.
importKey
(withalgorithm == 'HKDF'
)This is a feasible workaround. However, the point of
deriveKey
seems exactly to avoid needing to juggle raw key data in memory.To me, the easiest medium-term solution to this issue would be to permit
'HKDF'
as a value forderiveKey
'sderivedKeyAlgorithm
- or potentially some object that specifies the number of bits required, where necessary?The text was updated successfully, but these errors were encountered: