mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-07-29 04:09:13 +00:00
LibWeb: Implement skeleton of ECDSA sign for SubtleCrypto
This commit is contained in:
parent
41449814db
commit
bc2a5e24bc
Notes:
sideshowbarker
2024-07-17 01:06:10 +09:00
Author: https://github.com/stelar7
Commit: bc2a5e24bc
Pull-request: https://github.com/SerenityOS/serenity/pull/23737
Reviewed-by: https://github.com/ADKaster ✅
Reviewed-by: https://github.com/trflynn89
5 changed files with 113 additions and 0 deletions
|
@ -117,6 +117,22 @@ struct RsaOaepParams : public AlgorithmParams {
|
|||
|
||||
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;
|
||||
|
||||
EcdsaParams(String name, HashAlgorithmIdentifier hash)
|
||||
: AlgorithmParams(move(name))
|
||||
, hash(move(hash))
|
||||
{
|
||||
}
|
||||
|
||||
HashAlgorithmIdentifier hash;
|
||||
|
||||
static JS::ThrowCompletionOr<NonnullOwnPtr<AlgorithmParams>> from_value(JS::VM&, JS::Value);
|
||||
};
|
||||
|
||||
// https://w3c.github.io/webcrypto/#dfn-EcKeyGenParams
|
||||
struct EcKeyGenParams : public AlgorithmParams {
|
||||
virtual ~EcKeyGenParams() override;
|
||||
|
@ -229,6 +245,8 @@ private:
|
|||
|
||||
class ECDSA : public AlgorithmMethods {
|
||||
public:
|
||||
virtual WebIDL::ExceptionOr<JS::NonnullGCPtr<JS::ArrayBuffer>> sign(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;
|
||||
|
||||
static NonnullOwnPtr<AlgorithmMethods> create(JS::Realm& realm) { return adopt_own(*new ECDSA(realm)); }
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue