9 #include <botan/libstate.h>
10 #include <botan/parsing.h>
11 #include <botan/numthry.h>
12 #include <botan/keypair.h>
13 #include <botan/internal/assert.h>
21 size_t bits,
size_t exp)
26 if(exp < 3 || exp % 2 == 0)
36 }
while(
n.
bits() != bits);
57 if((
e *
d) %
lcm(
p - 1,
q - 1) != 1)
67 powermod_e_n(rsa.get_e(), rsa.get_n()),
68 powermod_d1_p(rsa.get_d1(), rsa.get_p()),
69 powermod_d2_q(rsa.get_d2(), rsa.get_q()),
76 BigInt RSA_Private_Operation::private_op(
const BigInt& m)
const
81 BigInt j1 = powermod_d1_p(m);
82 BigInt j2 = powermod_d2_q(m);
113 "RSA private op failed consistency check");
SecureVector< byte > sign(const byte msg[], size_t msg_len, RandomNumberGenerator &rng)
bool signature_consistency_check(RandomNumberGenerator &rng, const Private_Key &key, const std::string &padding)
std::string algo_name() const
std::invalid_argument Invalid_Argument
static SecureVector< byte > encode(const BigInt &n, Base base=Binary)
RSA_Private_Operation(const RSA_PrivateKey &rsa)
#define BOTAN_ASSERT(expr, msg)
RandomNumberGenerator * rng
Library_State & global_state()
SecureVector< byte > decrypt(const byte msg[], size_t msg_len)
BigInt unblind(const BigInt &x) const
BigInt reduce(const BigInt &x) const
bool check_key(RandomNumberGenerator &rng, bool) const
BigInt inverse_mod(const BigInt &n, const BigInt &mod)
BigInt blind(const BigInt &x) const
BigInt sub_mul(const BigInt &a, const BigInt &b, const BigInt &c)
std::string to_string(u64bit n, size_t min_len)
void gen_check(RandomNumberGenerator &rng) const
RSA_PrivateKey(const AlgorithmIdentifier &alg_id, const MemoryRegion< byte > &key_bits, RandomNumberGenerator &rng)
static SecureVector< byte > encode_1363(const BigInt &n, size_t bytes)
BigInt lcm(const BigInt &a, const BigInt &b)
BigInt mul_add(const BigInt &a, const BigInt &b, const BigInt &c)
BigInt random_prime(RandomNumberGenerator &rng, size_t bits, const BigInt &coprime, size_t equiv, size_t modulo)
bool check_key(RandomNumberGenerator &rng, bool) const