Web Crypto API deriveKey issues

Hi,

I’m using workers to generate and compare hashed values. The original values are hashed with python django using PBKDF2. The code is based on this post:
https://community.cloudflare.com/t/web-crypto-api-importkey-or-derivekey-not-generating-correctly/30836

I’ve ran into an issue with deriveKey.

const dkey = await crypto.subtle.deriveKey({
				name: 'PBKDF2',
				salt,
				iterations,
				hash
				},
				baseKey, {
				name: mode,
				hash: {
					name: hash
				},
				},
				true, ['sign', 'verify'],
			)

When the iterations are > 100,000, it throws a DOMException. My django hashes have iterations at 260,000. The most recent version of django hashes with 720,000 iterations.

I’ve run the code in jsfiddle with no issues. Is there an iteration limit in the worker platform? Am I doing this wrong?

Hi there,

I just answered in your ticket, but to keep a public record here as well,
100,000 is the maximum number of supported iterations for PBKDF2. This may change in future.

This seems to be a gap in the documentation currently, so thanks for bringing it up.

This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.