Technically, the term "signature" is reserved for, well, signatures and hash functions do not compute them.
To ensure that data has not been changed during the transfer, with a hash function, you must have a secure out-of-band way to transmit the hash value; adding a hash value to the HTTP headers will fail because anyone who can change the transmitted data can double-check the hash as desired and change the HTTP headers as they see fit.
With cryptography, you can "concentrate" on that secure out-of-band transmission in a reusable key. If the client and server have a common secret value unknown to the alleged attacker, then the acronym MAC, as in the "Message Authentication Code"; regular MAC HMAC .
In many practical situations, MAC cannot be used, because MAC requires a shared secret, and a secret that is shared too many times is no longer a secret. Each secret holder has the right to recount the MAC. If each client knows a secret, then in principle this is not a secret, and it can be safely assumed that the attacker also knows this. Therefore, you can go further and use digital signatures (real ones, those that use RSA, DSS, ECDSA ...), in which the server uses the private key (which only the server knows), and the clients only know about the corresponding public key. Knowledge of the public key is sufficient to verify signatures, but not to create new ones, and the private key cannot be overestimated from the public key (although they are mathematically related to each other). However, the introduction of a digital signature and its proper use is much more complicated than is usually accepted; it is best to use an already debugged protocol with existing implementations, and this protocol is called "SSL".
The fact is that without SSL, the likelihood that everything you do does not deter a certain attacker; it will just use processor cycles and network bandwidth and give you a warm fuzzy feel.
Thomas Pornin Feb 02 '10 at 14:45 2010-02-02 14:45
source share