Computing the endomorphism ring of an elliptic curve over a finite field
$ \newcommand{\End}{\mathrm{End}} \newcommand{\Gal}{\mathrm{Gal}} \newcommand{\kb}{\overline{k}} \newcommand{\Z}{\mathbb{Z}} \newcommand{\F}{\mathbb{F}} \newcommand{\Q}{\mathbb{Q}} $
I would like to have an algorithm (possibly very inefficient) that computes the endomorphism ring of a given elliptic curve $E$ over a finite field $k$.
For simplicity, we shall assume that $E$ is ordinary (to avoid maximal orders in quaternion algebras...), so it is enough to compute the conductor of $\End(E)$ in the imaginary quadratic field $K := \Q(\pi)$, where $q = |k|$ and $\pi = \sqrt{a_q^2 - 4q}$. We know that this conductor divides $[O_K : \Z[\pi]]$, the latter being quite easy to compute in Sage I suppose.
But now, is there a way to check whether, for a given $f \mid [O_K : \Z[\pi]]$, we have $\Z + f O_K = \End(E)$ ? This is where I don't know how to proceed.
I am aware of Kohel's thesis, which involves isogeny graphs, but I'm not sure if one can implement this in Sage easily.
Ideally, I want to reproduce the table on page 303 in Edixhoven, van der Geer and Moonen's Abelian Varieties, which lists $\End_{\Bbb F_7}(E)$ for all (isomorphism classes of) elliptic curves over $\Bbb F_7$.
Welcome to Ask Sage! Thank you for your question.
@slelievre : thanks for the update, and for your comment! I actually asked the same question there (https://math.stackexchange.com/questi...), but I might have more chance to get an answer here.
Now answered on math.SE.