mirror of
https://github.com/fergalmoran/ladybird.git
synced 2025-12-25 10:48:41 +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:
committed by
Ali Mohammad Pur
parent
d5e3a557fd
commit
9e08f71fd9
@@ -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);
|
||||
|
||||
Reference in New Issue
Block a user