MAC and HMAC
In this chapter, we will learn about message authentication codes (MACs), also known as authentication tags. MACs are used in popular secure network protocols, such as TLS, SSH, and IPsec in order to establish both the integrity and authenticity of the transmitted data. They are also used in proprietary network protocols, for example, in financial software, for the same purpose. Additionally, MACs can be used in non-networked authenticated encryption, as we demonstrated in Chapter 2, Symmetric Encryption and Decryption. Another application of MAC is as the basis of some key derivation functions, such as PBKDF2. Key derivation will be covered in more detail in Chapter 5, Derivation of an Encryption Key from a Password. We will learn how to calculate a MAC using both the command line and C code.
In this chapter, we are going to cover the following topics:
- What is a MAC?
- Understanding MAC function security
- HMAC – a hash-based MAC
- MAC, encryption...