$ \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 (iml.univ-mrs.fr/~kohel/pub/thesis.pdf), which involves isogeny graphs, but I'm not sure if one can implement this on SAGE easily.
Ideally, I want to reproduce the table on page 303 here (van-der-geer.nl/~gerard/AV.pdf), which lists $\End_{\Bbb F_7}(E)$ for all (isomorphism classes of) elliptic curves over $\Bbb F_7$.