8 #include <botan/elgamal.h>
9 #include <botan/numthry.h>
10 #include <botan/libstate.h>
11 #include <botan/keypair.h>
12 #include <botan/internal/workfactor.h>
92 BigInt a = powermod_g_p(k);
109 blinder =
Blinder(k, powermod_x_p(k), p);
117 const size_t p_bytes = p.
bytes();
119 if(msg_len != 2 * p_bytes)
123 BigInt b(msg + p_bytes, p_bytes);
128 a = blinder.
blind(a);
void load_check(RandomNumberGenerator &rng) const
void binary_encode(byte buf[]) const
SecureVector< byte > encrypt(const byte msg[], size_t msg_len, RandomNumberGenerator &rng)
const BigInt & get_x() const
const BigInt & group_p() const
std::invalid_argument Invalid_Argument
static SecureVector< byte > encode(const BigInt &n, Base base=Binary)
ElGamal_Decryption_Operation(const ElGamal_PrivateKey &key)
bool check_key(RandomNumberGenerator &rng, bool) const
bool check_key(RandomNumberGenerator &rng, bool) const
const BigInt & get_y() const
RandomNumberGenerator * rng
void randomize(RandomNumberGenerator &rng, size_t bitsize=0)
ElGamal_PrivateKey(const AlgorithmIdentifier &alg_id, const MemoryRegion< byte > &key_bits, RandomNumberGenerator &rng)
Library_State & global_state()
BigInt multiply(const BigInt &x, const BigInt &y) const
bool encryption_consistency_check(RandomNumberGenerator &rng, const Private_Key &key, const std::string &padding)
BigInt unblind(const BigInt &x) const
ElGamal_Encryption_Operation(const ElGamal_PublicKey &key)
BigInt inverse_mod(const BigInt &n, const BigInt &mod)
BigInt blind(const BigInt &x) const
BigInt power_mod(const BigInt &base, const BigInt &exp, const BigInt &mod)
const BigInt & group_g() const
size_t dl_work_factor(size_t bits)
void gen_check(RandomNumberGenerator &rng) const
const BigInt & get_modulus() const
SecureVector< byte > decrypt(const byte msg[], size_t msg_len)