Helping people with computers... one answer at a time.

Digital Signatures use public key cryptography to validate both message sender and message contents. Digital Signatures rely on simple concepts you should know, built on top of very complex mathematics you don't need to worry about.

What are Digital Signatures on emails and how do they protect me?

Digital Signatures are pretty much what they sound like: the digital equivalent of signing a document. If you digitally sign a message, it proves that you, and only you, actually did the signing.

In addition, it also allows the recipient of the message to confirm that the message wasn't changed after you signed it.

There is, of course, a catch. And we need to understand just a little about "public key cryptography".

Don't let the phrase fool you. While public key cryptography is a really, really complex science, the concepts you need to know to use it are really, really simple, once you get your brain around one concept.

You're probably already aware of simple encryption - you take a file, run it through an encryption tool of some sort that takes a password, and the file is scrambled using that password. In order to read the file, you need to run the file through the decryption tool, and you must supply the correct password again. This is called "symmetric" encryption, because you use the same password to encrypt, and then to decrypt the file.

"...public key cryptography is a really, really complex science, the concepts you need to know to use it are really, really simple..."

Enter asymmetric encryption. With this type of encryption, you use one password (now called a key) to encrypt your data, but then you use a different key to decrypt it.

Think about that for a moment, because it's not at all obvious.

That means that I might encrypt a file using a key, say "rubberduck", but in order to decrypt that file, you need to supply a different key, say "platypus". ("rubberduck" and "platypus" are just simple examples, and not actual, working, keys.)

Now, not just any two keys will do. These two keys go together. Only "platypus" can decrypt something that was encrypted using "rubberduck". And, very conveniently, the opposite works as well: if you encrypt something using "platypus", only "rubberduck" can decrypt it. These keys must be chosen, or rather, mathematically generated as a pair, in order for this relationship to hold. Together they are a key pair.

Here's where things get interesting.

What if I generated my pair of keys, and I keep one secret, and told the world the other one? Let's say I keep "rubberduck" a secret - no one knows that's the key that matches "platypus". But I tell world that my "public key" is "platypus". Here's what that enables:

  • Someone can encrypt a message to me, using my public key ("platypus"), and know that only I can decrypt it. Because only I know that "rubberduck" is the matching key that will decrypt something encrypted with "platypus".

  • I can encrypt a message using my private key ("rubberduck"), and anyone can decrypt it with my public key ("platypus"). Sounds pointless if anyone can decrypt it, until you realize that since they can, they know the message came from me. Only I have the private key that matches, only I can encrypt something that would be decryptable with my public key.

But so far, that's all been "encryption", not "signing". One more concept is required.

We now need to understand something called a "hash". As a VERY simple example, let's say I assigned a value from 0 to 255 for every character in the alphabet, every symbol, and every number that might appear in a text message. Now, I take a message and I add up all the numbers corresponding to all the characters in that message. The resulting number is a "hash value" of that message.

Now, just adding up the numbers happens to be a very poor hash algorithm, because it's easy to get two different messages to generate the same hash value, and it's also easy to alter a message to get the hash value you want. Change one 'a' to a 'b', and anther 'z' to a 'y', and the hash of the message might well calculate to exactly the same value.

Enter the "sha" algorithm. This is a complex mathematical algorithm that has the following two properties:

  • It's statistically extremely unlikely that an sha hash of two different messages would ever generate the same hash value

  • It's effectively impossible to generate or alter a message to generate a specific, desired, sha hash value.

There are other hash algorithms besides sha - md5 being the most common.

Now let's pull this together for signing...

After you've composed an email message, and you digitally sign it, this is what happens:

  • an sha hash of your email message is calculated

  • that sha hash is then encrypted using your private key

  • the encrypted sha hash is then appended below your email message.

Your recipient can then validate your message by:

  • decrypting the sha hash using your public key - if that works, they know the message came from you

  • calculating the sha hash of the message, and comparing their result to the decrypted sha hash that you included as your signature. If the hash values match, they know that the message was not altered.

One question that typically comes up is this: why not just encrypt the entire message?

Absolutely you can do that. In fact, if you want to maintain absolute security about the contents of your message, that's exactly what you must do.

But for situations where that type of security is not required, digital signing of this form adds very little overhead, gets you the validation you want, and allows your recipient to still read the message immediately, without requiring decryption.

Here's an example of a signed message:

Hash: SHA1

This is an example of signed email.

- ------------------------------------------------------------------------
Tech Questions? Get Answers:                
Suffering from Email Overload?      
Sooner or later, the jokes stop here:
Version: GnuPG v1.4.3 (MingW32)


You can see that I'm using GnuPG as my encryption tool. It includes the original message, and below it, the appended digital signature.

And here's my public key (my real-world equivalent to "platypus", above):

Version: GnuPG v1.4.0 (MingW32)


(You can see that public/private keys used for digital signing are much more involved that simple passwords like "rubberduck" or "platypus".)

Using that public key, you can now verify my signature. Since only I have the matching private key, only I could have encrypted the hash of the message, and hence only I could have signed it.

Public key encryption, and digital signing is some heavy duty computing. Heavy duty enough that when used properly it's considered one of the most secure ways to encrypt data and verify identity in the digital world.

The good news, though, is that while the mathematics is complex and the computing is quite involved, you only really need to deal with the much more simple, high level concepts.

Article C2713 - July 5, 2006 « »

Share this article with your friends:

Share this article on Facebook Tweet this article Email a link to this article
Leo Leo A. Notenboom has been playing with computers since he was required to take a programming class in 1976. An 18 year career as a programmer at Microsoft soon followed. After "retiring" in 2001, Leo started Ask Leo! in 2003 as a place for answers to common computer and technical questions. More about Leo.

Not what you needed?

July 13, 2006 5:18 AM

Er thanks. My head is swimming already. I'm seeing platypuses and rubberduckies along with da vinci code style letters...Score one for Mr. Langdon!

Jim Lemasters
February 13, 2007 12:19 PM

How are the Private & public keys actually disseminated and stored so that they are easily used by the sender and receiver of a message?
Who generates and distributes these keys?
How does the receiver know how to match the message with the right public key (by email address, user name, SSN)?
Couldn't the imposter just send their own public key that matches their private key in the phoney message?

Leo Notenboom
February 13, 2007 6:00 PM

Hash: SHA1

My examples are all based on GnuPG - open source GPG/PGP cryptography.

Private keys aren't managed - you keep your private key in a safe place.

Public keys can be shared publicly, like I have in a post here or two.
There are also keyservers that the encryption tools know about where you
can put your public key for anyone to retreive.

You generate your own public and private keys.

Keys are most commonly identified by email address.

An imposter could create a phoney key pair, post the public key as
belonging to someone else, and then use the private key in an attempt to
impersonate that someone else. That's why, for example, in addition to
posting my public key on a key server, I've also posted it here on a
site that I control. In practice, before accepting someone's public key
you want to take steps to confirm that it does, indeed, belong to the
person it claims to. There's another whole level of trust relationships
involving "signing" the keys, so that if someone you trust has signed a
public key, you can then trust that public key. It can get quite
complex. There's much more information on this in the GnuPG

Version: GnuPG v1.4.6 (MingW32)


Bob Rutske
September 15, 2009 1:44 PM

The story behind "Public Key Encryption" and how 3 young men came up with it is told in a fasinating book called, "Crypto". Recommended Read.

Bevin Pettitt
September 15, 2009 6:57 PM

Please provide more info on that book "Crypto".

September 26, 2009 10:06 AM

bevin: google it ;=)

September 4, 2010 8:37 AM

very nice article!

Alfred Siliano
November 10, 2010 1:55 AM

Yes, in terms of authentication and verification of identity, an electronic signature can be better than an ink-on-paper signature, depending on the system used.

April 28, 2011 9:09 PM

this is interesting, but why would i lose my c\documents and settings and my c\ (program files) aol safety and security center because of this broken digital signiture. AVG security picked this up. Without help and support i cannot use system restore. User accounts and automatic updates was also lost as well as many system files. Internet explorer was also lost. I was hoping you could please tell me what i have to do fix this computer? I am using XP pack3 . Thankyou Vern.

Comments on this entry are closed.

If you have a question, start by using the search box up at the top of the page - there's a very good chance that your question has already been answered on Ask Leo!.

If you don't find your answer, head out to to ask your question.