mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-05-31 15:32:51 +00:00
LibWeb: Implement AES-KW in WebCryptoAPI
Add support for AES-KW for key wrapping/unwrapping. Very similar implementation to other AES modes. Added generic tests for symmetric import and specific AES-KW ones. Adds ~400 test passes on WPT. Now we do better than Firefox in `WebCryptoAPI/wrapKey_unwrapKey`!
This commit is contained in:
parent
1d94d678b3
commit
94374f0d19
Notes:
github-actions[bot]
2024-12-17 10:01:25 +00:00
Author: https://github.com/devgianlu
Commit: 94374f0d19
Pull-request: https://github.com/LadybirdBrowser/ladybird/pull/2940
Reviewed-by: https://github.com/gmta ✅
13 changed files with 1640 additions and 9 deletions
|
@ -431,6 +431,24 @@ private:
|
|||
}
|
||||
};
|
||||
|
||||
class AesKw : public AlgorithmMethods {
|
||||
public:
|
||||
virtual WebIDL::ExceptionOr<GC::Ref<CryptoKey>> import_key(AlgorithmParams const&, Bindings::KeyFormat, CryptoKey::InternalKeyData, bool, Vector<Bindings::KeyUsage> const&) override;
|
||||
virtual WebIDL::ExceptionOr<GC::Ref<JS::Object>> export_key(Bindings::KeyFormat, GC::Ref<CryptoKey>) override;
|
||||
virtual WebIDL::ExceptionOr<JS::Value> get_key_length(AlgorithmParams const&) override;
|
||||
virtual WebIDL::ExceptionOr<Variant<GC::Ref<CryptoKey>, GC::Ref<CryptoKeyPair>>> generate_key(AlgorithmParams const&, bool, Vector<Bindings::KeyUsage> const&) override;
|
||||
virtual WebIDL::ExceptionOr<GC::Ref<JS::ArrayBuffer>> wrap_key(AlgorithmParams const&, GC::Ref<CryptoKey>, ByteBuffer const&) override;
|
||||
virtual WebIDL::ExceptionOr<GC::Ref<JS::ArrayBuffer>> unwrap_key(AlgorithmParams const&, GC::Ref<CryptoKey>, ByteBuffer const&) override;
|
||||
|
||||
static NonnullOwnPtr<AlgorithmMethods> create(JS::Realm& realm) { return adopt_own(*new AesKw(realm)); }
|
||||
|
||||
private:
|
||||
explicit AesKw(JS::Realm& realm)
|
||||
: AlgorithmMethods(realm)
|
||||
{
|
||||
}
|
||||
};
|
||||
|
||||
class HKDF : public AlgorithmMethods {
|
||||
public:
|
||||
virtual WebIDL::ExceptionOr<GC::Ref<CryptoKey>> import_key(AlgorithmParams const&, Bindings::KeyFormat, CryptoKey::InternalKeyData, bool, Vector<Bindings::KeyUsage> const&) override;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue