Technology in terms you understand. Sign up for the Confident Computing newsletter for weekly solutions to make your life easier. Click here and get The Ask Leo! Guide to Staying Safe on the Internet — FREE Edition as my thank you for subscribing!

Digital Signatures: what are they, and how do they protect me?


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”.

Become a Patron of Ask Leo! and go ad-free!

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,

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

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

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

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”,

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.

Do this

Subscribe to Confident Computing! Less frustration and more confidence, solutions, answers, and tips in your inbox every week.

I'll see you there!

9 comments on “Digital Signatures: what are they, and how do they protect me?”

  1. 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!

  2. 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?

    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)


  4. 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.

  5. 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.


Leave a reply:

Before commenting please:

  • Read the article.
  • Comment on the article.
  • No personal information.
  • No spam.

Comments violating those rules will be removed. Comments that don't add value will be removed, including off-topic or content-free comments, or comments that look even a little bit like spam. All comments containing links and certain keywords will be moderated before publication.

I want comments to be valuable for everyone, including those who come later and take the time to read.