Message authentication is defined as follows:
Message authentication is to verify the integrity of the message. When the receiver receives a message from the sender, the receiver can verify that the received message is true and has not been tampered with. It contains two meanings: one is to verify that the sender of information is true rather than forged, that is, data source authentication; The second is to verify that the information has not been tampered with, replayed or delayed during transmission.
Message authentication needs to use message signature algorithm to ensure the originality of the message, that is, the message sent by the sender is unique and effective, and there is no accidental tampering in the transmission process. The signature algorithm uses the public key to sign, which can ensure that the message has not been tampered with during transmission, and can also avoid certain security attacks, thus effectively ensuring the integrity and authenticity of the message.
Three methods of message authentication are as follows:
Password authentication
Use a pre-shared password or key to verify the integrity and authenticity of the message. The sender encrypts the message with the key and sends it with the message. The receiver decrypts the message with the same key and verifies whether the message matches the ciphertext sent by the sender.
Digital signature authentication
Use encryption technology to create and verify digital signatures to verify the integrity, authenticity and identity of messages. The sender digitally signs the message with its private key, and then sends the signed message. The receiver uses the sender's public key to verify the signature to ensure that the message is provided by the sender and has not been tampered with.
Message authentication code (MAC) authentication
Use keys and hash functions to create and verify a MAC to verify the integrity and authenticity of the message. The sender uses the key and hash function to calculate the message, and sends the generated MAC with the message.
The receiver uses the same key and hash function to calculate the received message, and verifies whether the calculated MAC matches the MAC sent by the sender. This method can also prevent the message from being changed, because even if the message content is slightly changed, the calculated MAC will not match the MAC sent by the sender.
These methods can be used individually or in combination to provide stronger message authentication and security.