In 2005, Kayal suggested that Schoofs algorithm for counting points on elliptic curves over finite fields might yield an approach to factor polynomials over finite fields in deterministic polynomial time. We present an exposition of his idea and then explain details of a generalization involving Pilas algorithm for abelian varieties.