deno
7f691542 - fix(ext/crypto): handle wrong algorithm in subtle.importKey without panicking (#32410)

Commit
161 days ago
fix(ext/crypto): handle wrong algorithm in subtle.importKey without panicking (#32410) ## Summary - Fixes #30243. Passing a valid PKCS#8 DER key with the wrong algorithm (e.g., an RSA key imported as ECDSA) to `crypto.subtle.importKey` caused a panic due to an `.unwrap()` on a `try_into()` conversion in `import_key_ec`. - Replaced the `.unwrap()` with `.map_err(|_| ImportKeyError::MalformedParameters)?` so it returns a proper error instead of panicking. - Added a regression test that generates an RSA PKCS#8 key and attempts to import it as ECDSA, asserting that it rejects. Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com>
Author
Parents
Loading