Mathematical Foundations for Public Key Cryptography