Yes, you can safely paint the interior and exterior of your fireplaces. Most professionals usually recommend you to paint the exteriors with acrylic latex paint, which is heat-resistant for up to a temperature of 200 degrees Fahrenheit. Few manufacturers also make paint for stone, concrete, and brick which you can try out if the heat-resistant part works out fine.
Moving inside, you should use a high-heat paint which can withstand a minimum of 1000 degree Fahrenheit or more. We advise you to use a roller or spray made for textures for applying the paint in your firebox.