mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-05-21 10:32:51 +00:00
LibCrypto: Make RSA::generate_key_pair
return ErrorOr
Not currently needed as it cannot fail, but useful for future commits.
This commit is contained in:
parent
d5e3a557fd
commit
9e08f71fd9
Notes:
github-actions[bot]
2025-01-12 00:15:00 +00:00
Author: https://github.com/devgianlu
Commit: 9e08f71fd9
Pull-request: https://github.com/LadybirdBrowser/ladybird/pull/3225
Reviewed-by: https://github.com/alimpfard
Reviewed-by: https://github.com/gmta ✅
4 changed files with 33 additions and 24 deletions
|
@ -764,7 +764,11 @@ WebIDL::ExceptionOr<Variant<GC::Ref<CryptoKey>, GC::Ref<CryptoKeyPair>>> RSAOAEP
|
|||
// and RSA public exponent equal to the publicExponent member of normalizedAlgorithm.
|
||||
// 3. If performing the operation results in an error, then throw an OperationError.
|
||||
auto const& normalized_algorithm = static_cast<RsaHashedKeyGenParams const&>(params);
|
||||
auto key_pair = ::Crypto::PK::RSA::generate_key_pair(normalized_algorithm.modulus_length, normalized_algorithm.public_exponent);
|
||||
auto maybe_key_pair = ::Crypto::PK::RSA::generate_key_pair(normalized_algorithm.modulus_length, normalized_algorithm.public_exponent);
|
||||
if (maybe_key_pair.is_error())
|
||||
return WebIDL::OperationError::create(m_realm, "Failed generating RSA key pair"_string);
|
||||
|
||||
auto key_pair = maybe_key_pair.release_value();
|
||||
|
||||
// 4. Let algorithm be a new RsaHashedKeyAlgorithm object.
|
||||
auto algorithm = RsaHashedKeyAlgorithm::create(m_realm);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue