How to Stop Man-in-the-Middle and Downgrade Attacks in Your Apps