TITLE: Number of points of elliptic curve over $\mathbb{F}_p$ with CM by $\sqrt{-2}$ when $p\equiv 1\bmod 8$
QUESTION [8 upvotes]: I was trying to calculate the number of points of the curve $E:y^2 = x^3 + 4x^2 + 2x$ over $\mathbb{F}_p$ for $p\equiv 1\bmod 8$ (In order to have $\sqrt{-2}\in\mathbb{F}_p$) but I did not succeed. This curve is mentioned in Silverman's Advanced Topics in the Arithmetic of Elliptic curves (Proposition 2.3.1) to have multiplication by $\sqrt{-2}$. 
Over these primes $p\equiv 1\bmod 8$ the curve $E$ has full $2$-torsion so $E(\mathbb{F}_p)\cong \mathbb{Z}/(2)\times \mathbb{Z}/(k)$. 
In this case my conjecture is that the size will be related to the factorization of $p=(a+b\sqrt{-2})(a-b\sqrt{-2})$ over $\mathbb{Z}[i\sqrt{2}]$, that is $p=a^2 + 2b^2$. Hence, $\#E(\mathbb{F}_p)=p+1\pm 2a$ where $a$ is odd (and the sign I do not know how to choose it yet). Calculating this reminds me to the proof of the Last Entry of Gauss Tagebuch.
I would like to have an elliptic curve with CM by $\sqrt{-2}$ such that I can know the number of points in terms of $p$. Does anybody has a suggestion? or maybe another curve?
Thanks

REPLY [7 votes]: Sorry for self-advertisement: the question of the "sign" that one must choose
(equivalently which $\pi$ or $\overline{\pi}$) is entirely answered in my
book GTM239, Section 8.5.2, some of the results being due to Mark Watkins
(unpublished I believe). The main idea is to show that any CM curve is
equivalent in an evident sense to a "basic" CM elliptic curve with a
specific equation, giving a relation between the number of points of
the initial curve and the "basic" curve, and then Theorem 8.5.8 determines
explicitly the number of points of that basic curve. I did not do the exercise
for your specific example, but it is completely algorithmic.