mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-07-06 09:01:53 +00:00
LibCrypto: Remove unused constructors from RSA
class
This commit is contained in:
parent
3431b3235c
commit
048d6b8012
Notes:
github-actions[bot]
2025-02-17 23:03:30 +00:00
Author: https://github.com/devgianlu
Commit: 048d6b8012
Pull-request: https://github.com/LadybirdBrowser/ladybird/pull/3606
2 changed files with 1 additions and 23 deletions
|
@ -10,7 +10,6 @@
|
||||||
#include <LibCrypto/ASN1/DER.h>
|
#include <LibCrypto/ASN1/DER.h>
|
||||||
#include <LibCrypto/BigInt/UnsignedBigInteger.h>
|
#include <LibCrypto/BigInt/UnsignedBigInteger.h>
|
||||||
#include <LibCrypto/Hash/HashManager.h>
|
#include <LibCrypto/Hash/HashManager.h>
|
||||||
#include <LibCrypto/NumberTheory/ModularFunctions.h>
|
|
||||||
#include <LibCrypto/OpenSSL.h>
|
#include <LibCrypto/OpenSSL.h>
|
||||||
#include <LibCrypto/PK/PK.h>
|
#include <LibCrypto/PK/PK.h>
|
||||||
|
|
||||||
|
@ -73,19 +72,6 @@ public:
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
RSAPrivateKey(Integer n, Integer d, Integer e, Integer p, Integer q)
|
|
||||||
: m_modulus(move(n))
|
|
||||||
, m_private_exponent(move(d))
|
|
||||||
, m_public_exponent(move(e))
|
|
||||||
, m_prime_1(move(p))
|
|
||||||
, m_prime_2(move(q))
|
|
||||||
, m_exponent_1(NumberTheory::Mod(m_private_exponent, m_prime_1.minus(1)))
|
|
||||||
, m_exponent_2(NumberTheory::Mod(m_private_exponent, m_prime_2.minus(1)))
|
|
||||||
, m_coefficient(NumberTheory::ModularInverse(m_prime_2, m_prime_1))
|
|
||||||
, m_length(m_modulus.trimmed_length() * sizeof(u32))
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
RSAPrivateKey(Integer n, Integer d, Integer e, Integer p, Integer q, Integer dp, Integer dq, Integer qinv)
|
RSAPrivateKey(Integer n, Integer d, Integer e, Integer p, Integer q, Integer dp, Integer dq, Integer qinv)
|
||||||
: m_modulus(move(n))
|
: m_modulus(move(n))
|
||||||
, m_private_exponent(move(d))
|
, m_private_exponent(move(d))
|
||||||
|
@ -101,14 +87,6 @@ public:
|
||||||
|
|
||||||
RSAPrivateKey() = default;
|
RSAPrivateKey() = default;
|
||||||
|
|
||||||
static RSAPrivateKey from_crt(Integer n, Integer e, Integer p, Integer q, Integer dp, Integer dq, Integer qinv)
|
|
||||||
{
|
|
||||||
auto phi = p.minus(1).multiplied_by(q.minus(1));
|
|
||||||
auto d = NumberTheory::ModularInverse(e, phi);
|
|
||||||
|
|
||||||
return { n, d, e, p, q, dp, dq, qinv };
|
|
||||||
}
|
|
||||||
|
|
||||||
Integer const& modulus() const { return m_modulus; }
|
Integer const& modulus() const { return m_modulus; }
|
||||||
Integer const& private_exponent() const { return m_private_exponent; }
|
Integer const& private_exponent() const { return m_private_exponent; }
|
||||||
Integer const& public_exponent() const { return m_public_exponent; }
|
Integer const& public_exponent() const { return m_public_exponent; }
|
||||||
|
|
|
@ -244,7 +244,7 @@ static WebIDL::ExceptionOr<::Crypto::PK::RSAPrivateKey<>> parse_jwk_rsa_private_
|
||||||
|
|
||||||
// We know that if any of the extra parameters are provided, all of them must be
|
// We know that if any of the extra parameters are provided, all of them must be
|
||||||
if (!jwk.p.has_value())
|
if (!jwk.p.has_value())
|
||||||
return ::Crypto::PK::RSAPrivateKey<>(move(n), move(d), move(e), 0, 0);
|
return ::Crypto::PK::RSAPrivateKey<>(move(n), move(d), move(e));
|
||||||
|
|
||||||
auto p = TRY(base64_url_uint_decode(realm, *jwk.p));
|
auto p = TRY(base64_url_uint_decode(realm, *jwk.p));
|
||||||
auto q = TRY(base64_url_uint_decode(realm, *jwk.q));
|
auto q = TRY(base64_url_uint_decode(realm, *jwk.q));
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue