kevlened / isomorphic-webcrypto

:game_die: webcrypto library for Node, React Native and IE11+
https://www.w3.org/TR/WebCryptoAPI/
MIT License
116 stars 43 forks source link

importKey does not support the PBKDF2 algorithm #52

Open kylehovey opened 3 years ago

kylehovey commented 3 years ago

I am attempting to do PBKDF2 key generation via a passphrase and cannot generate the key material for input to the deriveKey call with the following error:

Error: unsupported algorithm

Environment info:

Code to repro:

import crypto from 'isomorphic-webcrypto';

const encoder = new TextEncoder();

async function repro() {
  await crypto.ensureSecure();

  const keyMaterial = await crypto.subtle.importKey(
    'raw',
    encoder.encode(passphrase),
    {
      name: 'PBKDF2',
    },
    false,
    ['deriveBits', 'deriveKey'],
  );
}

repro();