I was told by an Navy Energics expert that the Army scraps single based propellants at 45 years, double based 20 years.
The Navy does not scrap by clock time, they test their powders. But 45/20 years is a good conservative average lifetime of gunpowder.
Gunpowder is deteriorating the day it leaves the factory. It is a high energy compound and it wants to become a low energy compound. As gunpowder breaks down it produces nitric acid gas. There is stuff in the gunpowder to sop this up, but eventually the inhibitors get used up.
Heat is the worst enemy of gunpowder. The breakdown rate is directly related to temperature. I was told it follows the Arrhenius equation. Look that up if you want to.
Water is bad for gunpowder. Water wicks nitroglycerine to the surface.
Lead styphnate has an indefinite storage life. Assuming you don't spray penetrating oil on them, bake them in an oven, or store them in a corrosive environment, primers should last a very long time.
I was told the best storage conditions were “Artic”. Cold and dry.
If you have case cracking, pin hole corrosion in your cases, if the powder comes out red, the ammo has been bad for years.