1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-05-31 14:28:12 +00:00

LibWeb: Support SubtleCrypto.exportKey for RSA-OAEP in JsonWebKey format

This commit is contained in:
Andrew Kaster 2024-03-13 21:19:57 -06:00 committed by Andrew Kaster
parent 2599142214
commit 1521a60a67
13 changed files with 367 additions and 6 deletions

View file

@ -106,6 +106,11 @@ public:
return WebIDL::NotSupportedError::create(m_realm, "generateKey is not supported"_fly_string);
}
virtual WebIDL::ExceptionOr<JS::NonnullGCPtr<JS::Object>> export_key(Bindings::KeyFormat, JS::NonnullGCPtr<CryptoKey>)
{
return WebIDL::NotSupportedError::create(m_realm, "exportKey is not supported"_fly_string);
}
static NonnullOwnPtr<AlgorithmMethods> create(JS::Realm& realm) { return adopt_own(*new AlgorithmMethods(realm)); }
protected:
@ -120,6 +125,7 @@ protected:
class RSAOAEP : public AlgorithmMethods {
public:
virtual WebIDL::ExceptionOr<Variant<JS::NonnullGCPtr<CryptoKey>, JS::NonnullGCPtr<CryptoKeyPair>>> generate_key(AlgorithmParams const&, bool, Vector<Bindings::KeyUsage> const&) override;
virtual WebIDL::ExceptionOr<JS::NonnullGCPtr<JS::Object>> export_key(Bindings::KeyFormat, JS::NonnullGCPtr<CryptoKey>) override;
static NonnullOwnPtr<AlgorithmMethods> create(JS::Realm& realm) { return adopt_own(*new RSAOAEP(realm)); }
@ -156,4 +162,6 @@ private:
}
};
ErrorOr<String> base64_url_uint_encode(::Crypto::UnsignedBigInteger);
}