Cryptography is used to provide security goals like confidentiality, integrity, authentication and non-repudiation. It involves encryption of messages using algorithms and keys. Symmetric key cryptography uses a shared secret key while public key cryptography uses separate public and private keys. Cryptographic protocols specify the steps entities take to achieve security objectives like key exchange and authentication. Cryptanalysis involves techniques to break cryptographic systems and protocols.