bool EC_Group::verify_group(RandomNumberGenerator& rng,
                            bool) const
   {
   //compute the discriminant
   Modular_Reducer p(get_p());
   BigInt discriminant = p.multiply(4, get_a());
   discriminant += p.multiply(27, get_b());
   discriminant = p.reduce(discriminant);
   //check the discriminant
   if(discriminant == 0)
      {
      return false;
      }
   //check for valid cofactor
   if(get_cofactor() < 1)
      {
      return false;
      }

   const PointGFp base_point = get_base_point();

   //check if the base point is on the curve
   if(!base_point.on_the_curve())
      {
      return false;
      }
   if((base_point * get_cofactor()).is_zero())
      {
      return false;
      }

   const BigInt& order = get_order();

   //check if order is prime
   if(!is_prime(order, rng, 128))
      {
      return false;
      }
   //check if order of the base point is correct
   if(!(base_point * order).is_zero())
      {
      return false;
      }
   return true;
   }
bool EC_Group::verify_group(RandomNumberGenerator& rng,
                            bool) const
   {
    
   Modular_Reducer p(get_p());
   BigInt discriminant = p.multiply(4, get_a());
   discriminant += p.multiply(27, get_b());
   discriminant = p.reduce(discriminant);
    
   if(discriminant == 0)
      {
      return false;
      }
    
   if(get_cofactor() < 1)
      {
      return false;
      }

   const PointGFp base_point = get_base_point();

    
   if(!base_point.on_the_curve())
      {
      return false;
      }
   if((base_point * get_cofactor()).is_zero())
      {
      return false;
      }

   const BigInt& order = get_order();

    
   if(!is_prime(order, rng, 128))
      {
      return false;
      }
    
   if(!(base_point * order).is_zero())
      {
      return false;
      }
   return true;
   }