Digital signatures

Encryption and decryption address problems of eavesdropping, but they do not address tampering and impersonation. However, public-key cryptography does address the problems of tampering and impersonation.

You can use your private key for encryption and your public key for decryption. Although this is not desirable when you are encrypting sensitive data, it is an important part of digitally signing any data. Rather than encrypting the data itself, you can create a one-way hash of the data and then use your private key to encrypt the hash. The encrypted hash, along with other information like the hashing algorithm, is known as a digital signature.

Figure 1 shows a simplified view of how you can use a digital signature to validate the integrity of signed data.
Figure 1. Digital signature validating data integrity

Figure 1 shows the original data and the digital signature transferred to the recipient. The digital signature is basically a one-way hash (or message digest) of the original data that was encrypted with the signer's private key. To validate the data's integrity, the recipient first uses the signer's public key to decrypt the digital signature. The recipient then uses the same hashing algorithm that generated the original hash to generate a new one-way hash of the same data. Information about the hashing algorithm used is sent with the digital signature; this is not shown in the figure. Finally, the recipient compares the two hash values. If they match, the data has not changed since it was signed. If the hashes do not match, the data may have been tampered with since it was first signed or the digital signature may have been created with a private key that does not correspond to the public key presented by the signer.

If the hashes match, the recipient can be assured that the public key used to decrypt the digital signature corresponds to the private key used to create the digital signature. However, confirming the identity of the signer also requires some way of confirming that the public key truly belongs to a particular person or other entity. Digital certificates and authentication are used in this case.

You can compare the significance of a digital signature to that of your handwritten signature. Once you have signed data, it is difficult to deny doing so later. This assumes that the private key was not compromised or out of the owner's control. Digital signatures make it difficult for the signer to deny having signed the data.