Apples, likes all other organic waste are ideal for composting.
You can cover the apples with leaves and soil to prevent them from being eaten by birds and insects. In a world where about 3.7 million apples are being thrown away every year, compositing them is a great way to turn what would be only “waste” into nutrients for our soils.
As long as you aren’t trying to compost apples only, or a ridiculous quantity of apples (more than 100kg in one spot), there should be no problem. Even hard apples will rot and get soft very soon. Moulds are part of the composting process and most often come from yeasts already present on the skin of the fruit.
These moulds might even be “intended” to help break down the apples and provide rich soil for the seeds, which is probably why the apple tree provided the flesh in the first place. Once the composting process has taken its course, these moulds will probably have been decomposed themselves.