📝 Message integrity in network security (14 MCQs)
Detecting Unauthorized Changes to Transmitted Data
Message integrity protects information against unauthorized modification, insertion, deletion, or reordering. It allows a receiver to determine whether received data matches what the sender protected. Integrity is distinct from confidentiality: a message may be readable yet integrity-protected, or encrypted without any reliable method for detecting malicious changes. Integrity checks are especially important for financial transactions, software updates, configuration changes, and control messages.
Hashes, Checksums and Keyed Integrity Mechanisms
A cryptographic hash produces a fixed-length digest, but an unkeyed hash alone does not prove who created the message. A message authentication code combines a secret key with the message to provide integrity and origin authentication among key holders. Digital signatures use public-key cryptography to support public verification of signed data.
Verifying a Message at the Receiving Endpoint
The sender computes an integrity value over the relevant message and sends it with the data, using a MAC or signature as required. The receiver independently computes or verifies the corresponding value. If verification fails, the message must be rejected or investigated rather than treated as authentic and unchanged. consistently.
Example: Detecting Alteration of a Bank Transfer
A bank application protects a transfer request with a keyed authentication tag. The receiving server recomputes the tag using its copy of the secret key and compares the result securely. If an attacker changes the beneficiary account or amount, verification fails, preventing the modified request from being accepted as protected data.
Integrity Protection Within Secure Network Protocols
Transport security protocols combine encryption with integrity protection so that attackers cannot silently modify protected records. Secure storage systems may authenticate files, while signed software packages allow verification without sharing a secret with every recipient. Sequence numbers and protocol state can also help detect replay or reordering, depending on the design.
Misconceptions About Message Integrity
'Encryption always detects tampering' is false; some encryption modes provide no integrity. 'A plain checksum authenticates the sender' is false; attackers can recompute it. 'A hash is reversible' is false; secure hashes are designed as one-way functions, not decryption methods. Security decisions should therefore be based on the actual property each control provides.
Exam Focus: Choosing the Right Integrity Method
Distinguish error-detection checksums from cryptographic hashes, MACs, and digital signatures. Identify whether the receiver shares a secret or verifies a public key. Explain why a keyed mechanism is needed for origin authentication, and why replay protection may require sequence numbers, nonces, or timestamps in addition to an integrity value. carefully.
Message Integrity Mechanism Terms
- Integrity - Protection against unauthorized data modification.
- Digest - Fixed-length result produced by hashing.
- MAC - Secret-key tag for message verification.
- Signature - Public-key value verifying signed information.
- Replay - Repetition of an earlier valid message.
- Sequence number - Value identifying message order in communication.
📝 All Message integrity in network security MCQs
Q1. What does the dictionary entry for the string 'BA' contain after it is added during LZW encoding?
📖 Explanation: In LZW, a new entry is created by appending the current character to the previous string (PreS). Thus the entry for 'BA' is stored as the concatenation of the previous entry 'B' and the character 'A', i.e., PreS + char.
Q2. In the example, what is the codeword output for the first character 'B'?
📖 Explanation: The example's Table 28.2 shows the first codeword generated for the character 'B' as the value 3. This reflects the initial dictionary indexing used in the demonstration, where 'B' is assigned codeword 3 before any new entries are added.
Q3. If the current dictionary entry is 'AB' with index 4 and the next input character is 'A', what new dictionary entry will be created in the else‑clause?
📖 Explanation: When the else‑clause executes, LZW adds a new entry formed by the previous string plus the next character. Here the previous string is 'AB' and the next character is 'A', so the new entry becomes the concatenation 'ABA', which matches option C.
Q4. Compare the actions taken in the if‑clause versus the else‑clause during LZW decoding. Which statement is true?
📖 Explanation: During LZW decoding, the if‑clause handles the normal case where the incoming codeword already exists, so no new entry is created. The else‑clause is triggered when the codeword is not yet in the dictionary, and it is the only branch that adds a new entry, making statement B correct.
Q5. In LZW decoding, if the next codeword is 5 but index 5 is not yet defined, what does the decoder output?
📖 Explanation: When a codeword is encountered that is not yet in the dictionary, LZW specifies that the decoder should output the previous decoded string followed by its first character. This special case ensures continuity of the output stream, corresponding to option A.
Q6. Evaluate how the presence of an incorrect codeword (e.g., 7) in the compressed stream affects the integrity of the decoded message.
📖 Explanation: An invalid codeword disrupts the synchronization between encoder and decoder. Once the decoder misinterprets a codeword, subsequent dictionary look‑ups are based on a wrong state, causing the rest of the output to be corrupted. Hence a single erroneous code typically corrupts the remainder of the message.
Q7. Applying the principle of message integrity, which technique can be combined with LZW to detect accidental alterations after decompression?
📖 Explanation: A CRC computes a short checksum over the original data and can be verified after decompression. Because CRC detection is independent of the compression algorithm, it reliably reveals any accidental bit flips that may have occurred, making it a suitable companion for LZW when integrity verification is required.
Q8. Suppose you compute a hash of the original uncompressed data before LZW compression. After decompression, you compare hashes. Which statement best describes the impact on integrity verification?
📖 Explanation: The hash is calculated on the original plaintext; after successful decompression the same plaintext is recovered, so the hashes will be identical provided the transmission was error‑free. Any discrepancy indicates tampering or corruption, confirming integrity when the hashes match.
Q9. Given the following sequence of codewords: 2, 3, 2, 5, 6, where the dictionary after processing the first three codes contains entries: 0='A',1='B',2='AB',3='BA',4='ABA'. Determine the string produced by the decoder after processing codeword 5.
📖 Explanation: Processing 2 yields 'AB', 3 yields 'BA', and 2 again yields 'AB'. After these steps the decoder has added entry 4='ABA'. Codeword 5 refers to the newly created entry 5='ABAB' (previous string 'AB' plus first character of 'AB'), so the output after codeword 5 is 'ABAB'.
Q10. Analyze the effect of a dictionary overflow (exceeding the maximum code size of 12 bits) on message integrity. Which outcome is most likely?
📖 Explanation: When the dictionary reaches the limit imposed by the code size, further additions cannot be represented correctly. This mismatch between encoder and decoder leads to loss of synchronization, causing subsequent symbols to be decoded incorrectly and thereby compromising message integrity.
Q11. Design a scheme that uses LZW compression together with a Merkle tree to guarantee message integrity. Which step is essential for the scheme to detect tampering?
📖 Explanation: A Merkle tree provides a hierarchical set of hashes; by placing the root hash in the message header, any alteration to any part of the compressed data or dictionary will change the root hash, allowing the receiver to detect tampering by recomputing and comparing this value.
Q12. If an attacker modifies a single codeword in the compressed stream, what is the minimum number of output symbols that can be altered after decompression?
📖 Explanation: The impact of a single altered codeword depends on where it occurs relative to the dictionary construction. In some cases the decoder may recover after the next correctly defined codeword, altering only a few symbols; in other cases the error propagates further. Hence the number of altered symbols is variable, not fixed.
Q13. Compare the error propagation characteristics of LZW versus Huffman coding when a bit error occurs. Which statement is accurate?
📖 Explanation: A single bit error in Huffman coding typically desynchronizes the variable‑length code boundaries, causing the rest of the stream to be misinterpreted. LZW, however, may continue decoding correctly after the erroneous codeword because the dictionary can recover, but the wrong entry can trigger a cascade of incorrect look‑ups before synchronization is restored.
Q14. Which of the following best explains why integrating a cryptographic hash with LZW compressed data improves integrity without compromising compression efficiency?
📖 Explanation: By appending a cryptographic hash of the compressed payload (or of the original data) to the transmitted packet, the receiver can verify integrity immediately after reception. This check occurs before decompression, allowing any tampering to be detected without needing to modify the LZW algorithm or its compression ratio.