Skip to content
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

(ext/crypto) importKey fulfills incorrect error #20931

Closed
panva opened this issue Oct 18, 2023 · 0 comments · Fixed by #25181
Closed

(ext/crypto) importKey fulfills incorrect error #20931

panva opened this issue Oct 18, 2023 · 0 comments · Fixed by #25181

Comments

@panva
Copy link
Contributor

panva commented Oct 18, 2023

Refs: w3c/webcrypto#356

To reproduce, run:

await crypto.subtle
  .importKey(
    "pkcs8",
    new Uint8Array([
      48, 102, 2, 1, 0, 48, 19, 6, 7, 42, 134, 72, 206, 61, 2, 1, 6, 8, 42, 134,
      72, 206, 61, 3, 1, 7, 4, 76, 48, 74, 2, 1, 1, 4, 32, 255, 255, 255, 255,
      0, 0, 0, 0, 255, 255, 255, 255, 255, 255, 255, 255, 188, 230, 250, 173,
      167, 23, 158, 132, 243, 185, 202, 194, 252, 99, 37, 81, 161, 35, 3, 33, 0,
      0, 255, 255, 255, 0, 0, 0, 0, 255, 255, 255, 255, 255, 255, 255, 255, 188,
      230, 250, 173, 167, 23, 158, 132, 243, 185, 202, 194, 252, 99, 37, 81,
    ]),
    { name: "ECDSA", namedCurve: "P-256" },
    true,
    ["sign"]
  )
  .catch((e) => {
    console.log(`e.name is ${e.name} but should be DataError`);
    console.log(e);
  });
e.name is Error but should be DataError
Error: InvalidComponent
    at importKeyEC (ext:deno_crypto/00_crypto.js:3076:31)
    at SubtleCrypto.importKey (ext:deno_crypto/00_crypto.js:966:16)
    at <anonymous>:2:21
deno --version
deno 1.37.2 (release, aarch64-apple-darwin)
v8 11.8.172.13
typescript 5.2.2
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant