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> 83 const BigInt& p = mod_p.get_modulus();
92 BigInt a = powermod_g_p(k);
93 BigInt b = mod_p.multiply(m, powermod_y_p(k));
109 blinder =
Blinder(k, powermod_x_p(k), p);
115 const BigInt& p = mod_p.get_modulus();
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);
virtual void load_check(RandomNumberGenerator &rng) const
SecureVector< byte > encrypt(const byte msg[], size_t msg_len, RandomNumberGenerator &rng)
bool check_key(RandomNumberGenerator &rng, bool) const
const BigInt & get_y() 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
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()
void binary_encode(byte buf[]) const
bool encryption_consistency_check(RandomNumberGenerator &rng, const Private_Key &key, const std::string &padding)
void load_check(RandomNumberGenerator &rng) const
ElGamal_Encryption_Operation(const ElGamal_PublicKey &key)
BigInt inverse_mod(const BigInt &n, const BigInt &mod)
const BigInt & group_p() const
BigInt power_mod(const BigInt &base, const BigInt &exp, const BigInt &mod)
size_t dl_work_factor(size_t bits)
const BigInt & get_x() const
const BigInt & group_g() const
SecureVector< byte > decrypt(const byte msg[], size_t msg_len)