A standard problem in elliptic curve cryptography is the selection of elliptic curves as the basis for a secure cryptosystem. The principle requirement is that structure of the group of rational points be of prime or near-prime order. One approach to the problem is to select curves at random and to count points—an expensive option. The alternative is to use the theory complex multiplication to construct elliptic curves with known endomorphism ring structure, whose reduction is known to have a predetermined number of points. This construction is also applied to the problem of primality proving. For this purpose the minimal polynomial of the j-invariant of those curves with fixed endomorphism ring R is computed over ℚ, and reduced modulo a prime. For example for disc(R) = -23, this class polynomial is: