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);
void binary_encode(byte buf[]) const
static SecureVector< byte > encode(const BigInt &n, Base base=Binary)
void randomize(RandomNumberGenerator &rng, size_t bitsize=0)
bool check_key(RandomNumberGenerator &rng, bool) const
const BigInt & get_x() const
DL_Scheme_PrivateKey(const AlgorithmIdentifier &alg_id, const MemoryRegion< byte > &key_bits, DL_Group::Format group_format)
const BigInt & group_p() const
const BigInt & get_y() const
const BigInt & group_g() const
SecureVector< byte > decrypt(const byte msg[], size_t msg_len)
ElGamal_Decryption_Operation(const ElGamal_PrivateKey &key)
SecureVector< byte > encrypt(const byte msg[], size_t msg_len, RandomNumberGenerator &rng)
ElGamal_Encryption_Operation(const ElGamal_PublicKey &key)
ElGamal_PrivateKey(const AlgorithmIdentifier &alg_id, const MemoryRegion< byte > &key_bits, RandomNumberGenerator &rng)
bool check_key(RandomNumberGenerator &rng, bool) const
Fixed_Exponent_Power_Mod()
void gen_check(RandomNumberGenerator &rng) const
void load_check(RandomNumberGenerator &rng) const
bool encryption_consistency_check(RandomNumberGenerator &rng, const Private_Key &key, const std::string &padding)
BigInt inverse_mod(const BigInt &n, const BigInt &mod)
size_t dl_work_factor(size_t bits)
BigInt power_mod(const BigInt &base, const BigInt &exp, const BigInt &mod)
std::invalid_argument Invalid_Argument
Library_State & global_state()