mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-08-07 00:29:15 +00:00
LibWeb: Implement skeleton of RSA-OAEP encrypt for SubtleCrypto
The actual Crypto algorithm part isn't implemented yet, so we just copy the plaintext and claim that's the ciphertext :^)
This commit is contained in:
parent
d71bd185c6
commit
29b68a1b10
Notes:
sideshowbarker
2024-07-17 09:37:30 +09:00
Author: https://github.com/ADKaster
Commit: 29b68a1b10
Pull-request: https://github.com/SerenityOS/serenity/pull/23596
Reviewed-by: https://github.com/alimpfard
3 changed files with 69 additions and 1 deletions
|
@ -102,6 +102,21 @@ struct RsaHashedImportParams : public AlgorithmParams {
|
|||
static JS::ThrowCompletionOr<NonnullOwnPtr<AlgorithmParams>> from_value(JS::VM&, JS::Value);
|
||||
};
|
||||
|
||||
// https://w3c.github.io/webcrypto/#dfn-RsaOaepParams
|
||||
struct RsaOaepParams : public AlgorithmParams {
|
||||
virtual ~RsaOaepParams() override;
|
||||
|
||||
RsaOaepParams(String name, ByteBuffer label)
|
||||
: AlgorithmParams(move(name))
|
||||
, label(move(label))
|
||||
{
|
||||
}
|
||||
|
||||
ByteBuffer label;
|
||||
|
||||
static JS::ThrowCompletionOr<NonnullOwnPtr<AlgorithmParams>> from_value(JS::VM&, JS::Value);
|
||||
};
|
||||
|
||||
class AlgorithmMethods {
|
||||
public:
|
||||
virtual ~AlgorithmMethods();
|
||||
|
@ -149,6 +164,8 @@ protected:
|
|||
|
||||
class RSAOAEP : public AlgorithmMethods {
|
||||
public:
|
||||
virtual WebIDL::ExceptionOr<JS::NonnullGCPtr<JS::ArrayBuffer>> encrypt(AlgorithmParams const&, JS::NonnullGCPtr<CryptoKey>, ByteBuffer const&) override;
|
||||
|
||||
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<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