mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-07-07 09:31:53 +00:00
LibWeb: Support RSA-PSS
in WebCryptoAPI
This commit is contained in:
parent
3eeb35e787
commit
e05ee9d297
Notes:
github-actions[bot]
2025-01-17 11:44:17 +00:00
Author: https://github.com/devgianlu
Commit: e05ee9d297
Pull-request: https://github.com/LadybirdBrowser/ladybird/pull/3252
Reviewed-by: https://github.com/gmta ✅
10 changed files with 1417 additions and 57 deletions
|
@ -195,6 +195,20 @@ struct RsaOaepParams : public AlgorithmParams {
|
|||
static JS::ThrowCompletionOr<NonnullOwnPtr<AlgorithmParams>> from_value(JS::VM&, JS::Value);
|
||||
};
|
||||
|
||||
// https://w3c.github.io/webcrypto/#dfn-RsaPssParams
|
||||
struct RsaPssParams : public AlgorithmParams {
|
||||
virtual ~RsaPssParams() override;
|
||||
|
||||
RsaPssParams(WebIDL::UnsignedLong salt_length)
|
||||
: salt_length(salt_length)
|
||||
{
|
||||
}
|
||||
|
||||
WebIDL::UnsignedLong salt_length;
|
||||
|
||||
static JS::ThrowCompletionOr<NonnullOwnPtr<AlgorithmParams>> from_value(JS::VM&, JS::Value);
|
||||
};
|
||||
|
||||
// https://w3c.github.io/webcrypto/#dfn-EcdsaParams
|
||||
struct EcdsaParams : public AlgorithmParams {
|
||||
virtual ~EcdsaParams() override;
|
||||
|
@ -377,6 +391,25 @@ private:
|
|||
}
|
||||
};
|
||||
|
||||
class RSAPSS : public AlgorithmMethods {
|
||||
public:
|
||||
virtual WebIDL::ExceptionOr<GC::Ref<JS::ArrayBuffer>> sign(AlgorithmParams const&, GC::Ref<CryptoKey>, ByteBuffer const&) override;
|
||||
virtual WebIDL::ExceptionOr<JS::Value> verify(AlgorithmParams const&, GC::Ref<CryptoKey>, ByteBuffer const&, ByteBuffer 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<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;
|
||||
|
||||
static NonnullOwnPtr<AlgorithmMethods> create(JS::Realm& realm) { return adopt_own(*new RSAPSS(realm)); }
|
||||
|
||||
private:
|
||||
explicit RSAPSS(JS::Realm& realm)
|
||||
: AlgorithmMethods(realm)
|
||||
{
|
||||
}
|
||||
};
|
||||
|
||||
class AesCbc : public AlgorithmMethods {
|
||||
public:
|
||||
virtual WebIDL::ExceptionOr<GC::Ref<JS::ArrayBuffer>> encrypt(AlgorithmParams const&, GC::Ref<CryptoKey>, ByteBuffer const&) override;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue