Construction of Elliptic Curves with Complex Multiplication: Applied to Primality Testing