Encryption provides a solution against sniffing, but alone it does not address spoofing or tampering (discussed in Part I). The concept of digital signatures has evolved to address such threats.
One-Way Hash Algorithms
Digital signatures rely on a mathematical function called a one-way hash. A hash differs from key-based cryptography. A hash utilizes a one-way (irreversible) mathematical function (a hash algorithm ) to transform data into a fixed-length digest, known as the hash value . Each hash value is unique. Thus, authentication using the hash value is similar to fingerprinting. To verify the origin of data, a recipient can decrypt the original hash and compare it to a second hash generated from the received message.
Two common one-way hash functions are MD5 and SHA-1. MD5 produces a 128-bit hash value, and is now considered less secure. SHA-1 produces a 160-bit hash value. In PKI, hashes are used to create digital signatures.
For example, when you open digitally-signed data, you rely on both the original data and the digital signature ”the one-way hash of the original data that has been encrypted with the signer's private key. To validate the integrity of the data, you first use the signer's public key to decrypt the hash. Next, you use the same hashing algorithm that generated the original hash to generate a new one-way hash of the same data. Details on the specific hashing algorithm used are sent with the digital signature itself. Finally, you compare the new hash against the original hash, and if the two hashes match, you know that the data has not changed since it was signed.
However, if the two hashes do not match, then either the data was altered since it was signed, or the signature was created with a private key that does not correspond to the public key presented by the signer. In this case, you have detected the hack and can reject the corrupt or false data.
An important service that digital signatures provide is nonrepudiation. In other words, the digital signatures make it difficult for the signer to deny having signed the data. However, as you will see later, nonrepudiation itself can be circumvented. For example, the system can be corrupted if the private key becomes compromised, or if it slips out of its owner's control.