You are correct, axle to crown is the key measurement for selecting a replacement fork. Unfortunately, it is often difficult to find this measurement. When searching for this information axle to crown can be listed many different ways on user forums such as axle to crown, axle-to-crown, A2C, A to C, ATC etc.
This is a good place to start for bigger brands forks:
Pinkbike - Official Axle To Crown Heights
In your particular situation I would contact RST to get the A2C for the fork and I would contact Specialized to find out what A2Cs are acceptable and covered by the warranty. This would be the safest route. Or another option is go to a bike shop for advice. They will find this information for you and help make a recommendation.
In reality you can put what ever fork you want on a bike, it's up to you but you accept the risk of injury if you go outside the manufacturer's spec.
Something else to consider is, just because you can put a larger/smaller fork on a bike doesn't mean you should. It can have an adverse effect on the bike's handling characteristics by changing the geometry (head tube angle, head tube height, wheelbase, standover, seat tube angle etc).