Skip to content
This repository has been archived by the owner on Sep 13, 2024. It is now read-only.

importKey does not support the PBKDF2 algorithm #52

Open
kylehovey opened this issue Aug 7, 2021 · 0 comments
Open

importKey does not support the PBKDF2 algorithm #52

kylehovey opened this issue Aug 7, 2021 · 0 comments

Comments

@kylehovey
Copy link

kylehovey commented Aug 7, 2021

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:

  • React Native 0.63.4
  • Ejected Expo app (ran npx pod-install before this)
  • MacOS, simulating on iOS 14.5 on iPhone 11 with XCode 12.5

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();
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant