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);
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
BigInt unblind(const BigInt &x) const
void randomize(RandomNumberGenerator &rng, size_t bitsize=0)
ElGamal_PrivateKey(const AlgorithmIdentifier &alg_id, const MemoryRegion< byte > &key_bits, RandomNumberGenerator &rng)
void gen_check(RandomNumberGenerator &rng) const
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)
const BigInt & get_modulus() const
BigInt blind(const BigInt &x) const
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
BigInt multiply(const BigInt &x, const BigInt &y) const
SecureVector< byte > decrypt(const byte msg[], size_t msg_len)