An Egyptian court has convicted a former Iranian diplomat and an Egyptian man of spying for Iran .