mirror of
https://github.com/LadybirdBrowser/ladybird
synced 2026-04-26 17:55:07 +02:00
LibWeb: Don't import raw X25519 key of incorrect length
This commit is contained in:
Notes:
github-actions[bot]
2025-07-26 16:44:27 +00:00
Author: https://github.com/hopafoot 🔰 Commit: https://github.com/LadybirdBrowser/ladybird/commit/ea8538ea49d Pull-request: https://github.com/LadybirdBrowser/ladybird/pull/5582 Reviewed-by: https://github.com/ADKaster ✅ Reviewed-by: https://github.com/awesomekling Reviewed-by: https://github.com/trflynn89
@@ -7258,6 +7258,11 @@ WebIDL::ExceptionOr<GC::Ref<CryptoKey>> X25519::import_key([[maybe_unused]] Web:
|
||||
if (!usages.is_empty())
|
||||
return WebIDL::SyntaxError::create(m_realm, "Usages must be empty"_string);
|
||||
|
||||
// AD-HOC: if the key length is not 32 bytes, then throw a DataError.
|
||||
// See: https://github.com/w3c/webcrypto/issues/409
|
||||
if (32 != key_data.get<ByteBuffer>().size())
|
||||
return WebIDL::DataError::create(m_realm, "X25519 key must be 32 bytes"_string);
|
||||
|
||||
// 2. Let algorithm be a new KeyAlgorithm object.
|
||||
auto algorithm = KeyAlgorithm::create(m_realm);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user