示例#1
0
/*************************************************
* DH_Core Constructor                            *
*************************************************/
DH_Core::DH_Core(RandomNumberGenerator& rng,
                 const DL_Group& group, const BigInt& x)
   {
   op = Engine_Core::dh_op(group, x);

   const BigInt& p = group.get_p();

   BigInt k(rng, std::min(p.bits()-1, BLINDING_BITS));

   if(k != 0)
      blinder = Blinder(k, power_mod(inverse_mod(k, p), x, p), p);
   }
示例#2
0
/*************************************************
* IF_Core Constructor                            *
*************************************************/
IF_Core::IF_Core(RandomNumberGenerator& rng,
                 const BigInt& e, const BigInt& n, const BigInt& d,
                 const BigInt& p, const BigInt& q,
                 const BigInt& d1, const BigInt& d2, const BigInt& c)
   {
   op = Engine_Core::if_op(e, n, d, p, q, d1, d2, c);

   if(BLINDING_BITS)
      {
      BigInt k(rng, std::min(n.bits()-1, BLINDING_BITS));
      blinder = Blinder(power_mod(k, e, n), inverse_mod(k, n), n);
      }
   }
示例#3
0
/*************************************************
* ELG_Core Constructor                           *
*************************************************/
ELG_Core::ELG_Core(RandomNumberGenerator& rng,
                   const DL_Group& group, const BigInt& y, const BigInt& x)
   {
   op = Engine_Core::elg_op(group, y, x);

   const BigInt& p = group.get_p();
   p_bytes = p.bytes();

   if(BLINDING_BITS)
      {
      BigInt k(rng, std::min(p.bits()-1, BLINDING_BITS));
      blinder = Blinder(k, power_mod(k, x, p), p);
      }
   }
示例#4
0
DH_KA_Operation::DH_KA_Operation(const DH_PrivateKey& dh) :
   p(dh.group_p()), powermod_x_p(dh.get_x(), p)
   {
   BigInt k(global_state().global_rng(), p.bits() - 1);
   blinder = Blinder(k, powermod_x_p(inverse_mod(k, p)), p);
   }