1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-26 05:47:34 +00:00

LibWeb: Implement SubtleCrypto.generateKey for RSA-OAEP

This patch implements and tests window.crypto.sublte.generateKey with
an RSA-OAEP algorithm. In order for the types to be happy, the
KeyAlgorithms objects are moved to their own .h/.cpp pair, and the new
KeyAlgorithms for RSA are added there.
This commit is contained in:
Andrew Kaster 2024-03-08 16:30:17 -07:00 committed by Andrew Kaster
parent 008c89edde
commit a9d240c647
12 changed files with 536 additions and 81 deletions

View file

@ -6,6 +6,7 @@
#pragma once
#include <LibCrypto/PK/RSA.h>
#include <LibJS/Forward.h>
#include <LibJS/Heap/GCPtr.h>
#include <LibWeb/Bindings/CryptoKeyPrototype.h>
@ -20,7 +21,7 @@ class CryptoKey final : public Bindings::PlatformObject {
JS_DECLARE_ALLOCATOR(CryptoKey);
public:
using InternalKeyData = Variant<ByteBuffer, Bindings::JsonWebKey>;
using InternalKeyData = Variant<ByteBuffer, Bindings::JsonWebKey, ::Crypto::PK::RSAPublicKey<>, ::Crypto::PK::RSAPrivateKey<>>;
[[nodiscard]] static JS::NonnullGCPtr<CryptoKey> create(JS::Realm&, InternalKeyData);