In a Lamport signature scheme, the security relies on the pre-image resistance of a cryptographic hash function. The scheme uses a set of precomputed hash values (for both "0" and "1" bits of the private key) and reveals one of these values for each bit of the message being signed. The order of these revealed values corresponds directly to the bits of the message.
Here’s why an attacker cannot change the order of bytes in a Lamport signature without invalidating the signature:
-
Structure of Lamport Signature:
- The signature consists of a sequence of hash values, where each hash value corresponds to a specific bit of the message.
- For each bit
b_i of the message, the signer reveals either H(x_i) (if b_i = 0) or H(y_i) (if b_i = 1), where x_i and y_i are precomputed values from the private key.
-
Verification Process:
- During verification, the verifier hashes the revealed values and compares them to the corresponding values in the public key.
- The order of the revealed values must match the order of the message bits. If the order is changed, the hashes will not match the expected values in the public key, and the signature will fail verification.
-
Security Implications:
- Changing the order of bytes in the signature would result in a mismatch between the message bits and the revealed hash values.
- This would immediately cause the signature to be rejected as invalid.
Example:
Suppose the message is 101, and the corresponding signature reveals H(y_1), H(x_2), H(y_3). If an attacker reorders the signature to H(y_3), H(x_2), H(y_1), the verifier would hash these values and compare them to the public key. However, the hashes would not align with the expected values for the message 101, and the signature would be rejected.
Conclusion:
An attacker cannot change the order of bytes in a Lamport signature without rendering the signature invalid. The scheme's security ensures that any tampering with the order of the revealed hash values will be detected during verification.