This paper deals the public key cryptography and Quantum cryptography and its uses in the applications such as Key Agreement, Data Encryption and Digital Signature. This paper discusses some public key algorithms, mathematical explanations on the working of these algorithms and also gives a brief introduction to modular arithmetic, which is the core arithmetic of almost all public key algorithms. Quantum cryptography could well be the first application of quantum mechanics at the single-quantum level.