mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-06-03 17:02:56 +00:00
LibWeb: Implement importKey for RSA-OAEP
This commit is contained in:
parent
28dc076764
commit
a0623a47de
Notes:
sideshowbarker
2024-07-17 05:05:51 +09:00
Author: https://github.com/ADKaster
Commit: a0623a47de
Pull-request: https://github.com/SerenityOS/serenity/pull/23596
Reviewed-by: https://github.com/alimpfard
5 changed files with 421 additions and 3 deletions
|
@ -87,6 +87,21 @@ struct RsaHashedKeyGenParams : public RsaKeyGenParams {
|
|||
static JS::ThrowCompletionOr<NonnullOwnPtr<AlgorithmParams>> from_value(JS::VM&, JS::Value);
|
||||
};
|
||||
|
||||
// https://w3c.github.io/webcrypto/#dfn-RsaHashedImportParams
|
||||
struct RsaHashedImportParams : public AlgorithmParams {
|
||||
virtual ~RsaHashedImportParams() override;
|
||||
|
||||
RsaHashedImportParams(String name, HashAlgorithmIdentifier hash)
|
||||
: AlgorithmParams(move(name))
|
||||
, hash(move(hash))
|
||||
{
|
||||
}
|
||||
|
||||
HashAlgorithmIdentifier hash;
|
||||
|
||||
static JS::ThrowCompletionOr<NonnullOwnPtr<AlgorithmParams>> from_value(JS::VM&, JS::Value);
|
||||
};
|
||||
|
||||
class AlgorithmMethods {
|
||||
public:
|
||||
virtual ~AlgorithmMethods();
|
||||
|
@ -125,6 +140,8 @@ 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<CryptoKey>> import_key(AlgorithmParams const&, Bindings::KeyFormat, CryptoKey::InternalKeyData, 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)); }
|
||||
|
@ -163,5 +180,6 @@ private:
|
|||
};
|
||||
|
||||
ErrorOr<String> base64_url_uint_encode(::Crypto::UnsignedBigInteger);
|
||||
WebIDL::ExceptionOr<::Crypto::UnsignedBigInteger> base64_url_uint_decode(JS::Realm&, String const& base64_url_string);
|
||||
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue