  In the seminal works from Santos and Gozalo [Europhys. Lett. $\mathbf{45}$,
418 (1999)] and Marletto and Vedral [Phys. Rev. Lett. $\mathbf{125}$, 040401
(2020)], it is shown how the Aharonov-Bohm effect can be described as the
result of an exchange of virtual photons between the solenoid and the quantum
charged particle along its propagation through the interferometer, where both
the particle and the solenoid interact locally with the quantum electromagnetic
field. This interaction results in a local and gauge-independent phase
generation for the particle propagation in each path of the interferometer.
Here we improve the cited treatments by using the quantum electrodynamics
formalism in the Lorentz gauge, with a manifestly gauge-independent Hamiltonian
for the interaction and the presence of virtual longitudinal photons. Only with
this more complete and gauge-independent treatment it is possible to justify
the acquired phases for interferometers with arbitrary geometries, and this is
an advantage of our treatment. We also extend the results to the electric
version of the Aharonov-Bohm effect. Finally, we propose an experiment that
could test the locality of the Aharonov-Bohm phase generation.
