Is there a good primer (spray can) to stop cast iron engine parts from rusting?

I'm sure it works great, but can you get epoxy primer in a spray can?

Yes you can. Eastwood has a lineup of 2k paints and primers in a can. Stuff has hardener in it and is 10x better than regular spray can junk.