Yes, Hard Candy Can Get Moldy. Here's How To Properly Store It - Tasting Table
Briefly

Hard candy has a long shelf life due to its high sugar content, which acts as a natural preservative. While it can last for many years, proper storage is essential. Individually wrapped candies, like Jolly Ranchers, last longer than unwrapped ones. To maintain their quality, it's advisable to store hard candies in airtight containers, separate by flavor, and keep in a cool, dark place. Signs of spoilage include moisture and changes in texture or taste, making it important to monitor stored candies.
Moisture is the enemy of preservation, by nature, hard candy has less moisture in its chemical makeup and that's why it tends to last longer than its chocolate or gummy counterparts.
Individually wrapped hard candies, like Jolly Ranchers, tend to have a longer shelf life because of the protective, plastic layer.
It's good practice to separate your hard candy by flavors, this will ensure that as they sit over time they don't cross-contaminate and turn a sweet taste into a sour one.
With proper storage, hard candy can safely last for at least a year, if not multiple years.
Read at Tasting Table
[
|
]