Q
Get started Bring yourself up to speed with our introductory content.

How to use a public key and private key in digital signatures

Ensuring authenticity of online communications is critical to conduct business. Learn how to use a public key and private key in digital signatures to manage electronic documents.

A person's handwritten signature is relatively unique; so, when someone signs a paper document, the signature verifies...

the signer. But how do you sign an electronic document? This is where a digital signature comes in.

Like a John Hancock on a contractual agreement or a notary seal on a legal document, a digital signature marks the authenticity of a digital message, document or software. Like its physical counterpart, the purpose of digital signature is to verify the document and the sender is who they claim to be.

In many countries -- the United States included -- digital signatures are considered legally binding, in the same way that handwritten signatures indicate a conscious agreement was made. Committing the crime of signature forgery may result in penalties ranging from restitution, fines, community service or probationary periods -- even jail time in some extreme cases.

Public and private keys

In cryptography, a key is a value used with an algorithm to encrypt and/or decrypt data. A private key, also known as a secret key, is kept on its owner's system and never transmitted publicly. A public key, as the name implies, is openly available to anyone who wants it. It can be posted to a public key server, as in a public key infrastructure system.

There are two main types of encryption that use keys: symmetric encryption and asymmetric encryption. In symmetric encryption, information is converted from plaintext to ciphertext using the same private key to encrypt and decrypt. In asymmetric encryption, a public key and a private key are used. The sender's private key encrypts the data -- this is the digital signature -- and the receiver uses the public key to decrypt it and verify it matches the attachment. The public key and private key in digital signatures are mathematically related but cannot be generated from each other. Because private keys are specifically assigned and unique to each user, they provide verified authenticity to the sender's message.

Diagram comparing symmetric and asymmetric encryption
Symmetric encryption uses two secret keys, while asymmetric encryption uses one public key and one private key.

The process of signing digital documents requires each party to trust that the individual creating the digital signature has not shared their private key with anyone. If other people were to obtain access to the private key, they could create a fraudulent digital signature in the private key holder's name.

Creating digital signatures

A digital signature is created by signing software -- for example, an email program. Because they provide evidence that an online document or message was not intentionally or unintentionally altered, digital signatures help build trust between parties, including vendors, customers, business partners and employees. Digital signatures also create transparency of various online exchanges. They are a fixture in online business transactions today for convenience and security reasons.

Public key encryption is quite slow. To address this, messages are hashed and then encrypted with the private key, as opposed to encrypting the entire message to create the digital signature. For example, the signing software first creates a one-way hash of the digital document that must be signed. In this way, a digital signature is created by applying a hash function to an online document. Any potential tampering of the online document would result in a different hash value than the original document's hash value. If the two values match, the integrity of the document is assured.

Digital signatures vs. digital certificates

It is important to note that a digital signature and a digital certificate are not the same thing. Whereas a digital signature validates the authenticity of a message, software or digital document, a digital certificate, also known as a public key certificate, verifies the public key belongs to the issuer.

Digital certificates contain the public key, information about its owner, expiration dates and the digital signature of the certificate issuer. A digital certificate is issued by a trusted third party called a certificate authority, such as GlobalSign or DigiCert. When choosing a digital certificate, it is critical to be aware of the expiration date, as well as how to renew expired certificates.

This was last published in June 2020

Dig Deeper on PKI and digital certificates

Join the conversation

5 comments

Send me notifications when other members comment.

Please create a username to comment.

How client (say browser) verifies that the certificate it received from server is indeed issued by CA? What information it uses it to verify it? Do browser have any information in it that verifies it?
Cancel
In the article Asymmetrical Encryption is introduced/defined by:

"In asymmetric encryption, a public key and a private key are used. The sender's private key encrypts the data -- this is the digital signature -- and the receiver uses the (senders (added by me)) public key to decrypt it and verify it matches the attachment."

But the 2nd line of the "Symmetric vs Asymmetric" graphic reads (abbrev):

[plaintxt]->[public key enc]->[ciphertxt]->[private key dec]->[plaintxt]

This is not the same thing. Which is right?


Cancel
It seems to me it could go either way.

The sender can encrypt with his (a) private key or (b) *the recipient's* public key.

The recipient can decrypt with (a) the sender's public key or (b) his own private key.

Maybe (a) seems better, as it provides evidence that the message came from the sender, but either would work, right? In fact, (b) might serve as a vector for the recipient to receive malware encrypted with the recipient's public key. So, I sure *hope* (a) is the way it's done.
Cancel
In addition, maybe my problem (and your problem) is that you are running together the description of how to encrypt and decrypt a message with the explanation of how to digitally sign a message?

Your sentence: "Public key encryption is quite slow.", and other things I've read, lead me to speculate that the whole <encryption> + <digital-signing> process actually works like this:

1) Using public/private key encryption the sender and receiver negotiate and agree upon a *symmetric* encryption algorithm and seed/salt to use. This process may involve several exchanges, and I hope that for each the sender (of the particular message) encrypts with their own private key, and the receiver decrypts with the sender's public key.

2) The sender encrypts the data with the agreed-upon symmetric key & seed.

3) The sender generates a hash of the encrypted data, using some algorithm.

4) The sender encrypts the hash from (3), and maybe some other data like the  algorithm used to generate the hash, with his private key.

5) The sender sends the symmetrically-encrypted data and the private-key-encrypted hash info to the receiver.

6) The receiver decrypts the hash info using the sender's public key.

7) The receiver re-generates the hash, using the algorithm the sender gave them, and (if all goes well) matches it with the decypted hash from the sender.

8) The receiver (finally) symmetrically decrypts the message, using the algorithm & seed from (1).

Is *this* how it actually works? If not, can you describe the real process at this level of detail and/or say how to change my explanation? (Like for example, maybe the sender hases before they symmetrically encrypt?)

Cancel
I have no idea why the font size jumps around in these comments sometimes. Sorry about that.
Cancel

SearchCloudSecurity

SearchNetworking

SearchCIO

SearchEnterpriseDesktop

SearchCloudComputing

ComputerWeekly.com

Close