mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-05-30 06:52:52 +00:00
LibWeb: Fix modulus length being wrong for RSA-OAEP key import
This commit is contained in:
parent
23fc04d264
commit
37f2818e90
Notes:
github-actions[bot]
2024-10-27 10:31:59 +00:00
Author: https://github.com/stelar7
Commit: 37f2818e90
Pull-request: https://github.com/LadybirdBrowser/ladybird/pull/1976
1 changed files with 2 additions and 2 deletions
|
@ -902,12 +902,12 @@ WebIDL::ExceptionOr<JS::NonnullGCPtr<CryptoKey>> RSAOAEP::import_key(Web::Crypto
|
||||||
// 6. Set the publicExponent attribute of algorithm to the BigInteger representation of the RSA public exponent.
|
// 6. Set the publicExponent attribute of algorithm to the BigInteger representation of the RSA public exponent.
|
||||||
TRY(key->handle().visit(
|
TRY(key->handle().visit(
|
||||||
[&](::Crypto::PK::RSAPublicKey<> const& public_key) -> WebIDL::ExceptionOr<void> {
|
[&](::Crypto::PK::RSAPublicKey<> const& public_key) -> WebIDL::ExceptionOr<void> {
|
||||||
algorithm->set_modulus_length(public_key.length());
|
algorithm->set_modulus_length(public_key.modulus().trimmed_byte_length() * 8);
|
||||||
TRY(algorithm->set_public_exponent(public_key.public_exponent()));
|
TRY(algorithm->set_public_exponent(public_key.public_exponent()));
|
||||||
return {};
|
return {};
|
||||||
},
|
},
|
||||||
[&](::Crypto::PK::RSAPrivateKey<> const& private_key) -> WebIDL::ExceptionOr<void> {
|
[&](::Crypto::PK::RSAPrivateKey<> const& private_key) -> WebIDL::ExceptionOr<void> {
|
||||||
algorithm->set_modulus_length(private_key.length());
|
algorithm->set_modulus_length(private_key.modulus().trimmed_byte_length() * 8);
|
||||||
TRY(algorithm->set_public_exponent(private_key.public_exponent()));
|
TRY(algorithm->set_public_exponent(private_key.public_exponent()));
|
||||||
return {};
|
return {};
|
||||||
},
|
},
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue