Cosmic magnetic fields theory