What is a Public Key and How Does it Work? (2024)

What is a Public Key and How Does it Work? (1)

By

  • TechTarget Contributor

What is a public key?

In cryptography, a public key is a large numerical value that is used to encrypt data. The key can be generated by a software program, but more often, it is provided by a trusted, designated authority and made available to everyone through a publicly accessible repository or directory.

A public key is also used to encrypt a message or check the legitimacy of a digital signature. It is accompanied by a corresponding private key, which is known only to its owner. Private keys are used to decrypt messages that were created with the corresponding public key or to create signatures. In other words, a public key locks up data from unauthorized use, while a private key is used to unlock it.

Public keys are available from a certificate authority, which issues digital certificates that prove the owner's identity and contain the owner's public key. Public keys are created using an asymmetric algorithm, which pairs the public key with an associated private key. The most common algorithms used to generate public keys are Rivest-Shamir-Adleman, elliptic curve cryptography and Digital Signature Algorithm.

A public key can be given to any person with whom an individual wants to communicate, whereas a private key belongs to the individual it was created for and isn't shared. The public key is typically stored on a public key infrastructure server and is used to encrypt data securely before it is sent over the internet.

What is a Public Key and How Does it Work? (2)

How does a public key work?

A cryptographic key is a mathematical algorithm implemented in software or hardware and used to encrypt or decrypt data. It is a string of bits that are combined with the data to create ciphertext. The cryptographic key can also be used to unencrypt data back to plaintext.

The two main types of cryptographic algorithms are symmetric and asymmetric. Symmetric key algorithms work by using a single key to encrypt and decrypt information, whereas asymmetric cryptography uses two keys: a public key to encrypt messages and a private key to decode them.

What is a Public Key and How Does it Work? (3)

The process for sending and receiving data via asymmetric cryptography typically consists of five steps:

  1. Key generation. Each individual generates a public and private key.
  2. Key exchange. The sender and recipient exchange public keys.
  3. Encryption. The sender's data is encrypted using the recipient's public key.
  4. Sending encrypted data. The encrypted data is sent to the recipient.
  5. Decryption. The recipient decrypts the message using their own private key.

Public key applications

Some applications of public key technology include the following.

What is a Public Key and How Does it Work? (4)

Encryption

This is the main use of a public key to encrypt messages prior to sending. With asymmetric encryption, both the public and private keys are generated randomly. Anyone can have access to a public key to encrypt data, but only an individual who has the matching private key can decrypt the data.

Since the public and private keys are mathematically connected, they are used together to encrypt and decrypt information. If anyone other than the owner of the private key tries to decrypt the information using the public key, the information will be unreadable.

Digital signatures

Public key encryption can also be used to create digital signatures. The digital signatures are generated via the following steps:

  1. The sender identifies the file to be digitally signed.
  2. The document application on the sender's computer calculates a unique hash value for the contents of that file.
  3. The sender's private key is used to encrypt the hash value, creating the digital signature.
  4. The original file and the digital signature are sent together to the recipient.
  5. The recipient uses the sender's public key to decrypt the digital signature's hash.
  6. The recipient's computer calculates the hash of the original file and compares it with the decrypted hash. If the two hashes match, the signature is verified. If the hashes don't match, that's evidence that the document has been altered or that the signature isn't valid.
What is a Public Key and How Does it Work? (5)

Secure Socket Layer and Transport Layer Security connections

SSL/TLS use public key encryption to create a secure connection between the server and client. This encryption method enables the use of Hypertext Transfer Protocol Secure. The communication session is first established using asymmetric encryption to establish the identities of both parties and to exchange a shared session key that enables a symmetric cipher. Symmetric encryption, using a shared key, is faster and more efficient than asymmetric encryption so it makes sense to use it for as much of the communication as possible.

Public key risks

While public key encryption is more secure than symmetric encryption, there are a few risks to consider, including the following:

  • Low-quality key. A poorly crafted asymmetric key algorithm -- one that's too short in length, for example -- is a security risk.
  • Lost private key. If the private key is lost or misplaced, access to the data becomes problematic.
  • Man-in-the-middle (MitM) attacks. Public key encryption can be a target for MitM attacks. The two main ways of trusting the identity of a website are the site's security certificate and its public key encryption. If either of these is compromised, a malicious party can insert itself into the connection between a user and a website and then capture any information sent between the two.

The origin of public key encryption

In 1976, Whitfield Diffie, Martin Hellman and Ralph Merkle published a paper titled "New Directions in Cryptography." In this paper, they introduced the idea of public key cryptography and described the first known functional distributed cryptographic protocol. Since then, the public key encryption algorithm has been used in finance, e-business and e-commerce to keep data secure by using two mathematically related keys.

Learn more about asymmetric and symmetric encryption, along with everything you need to know about data security in general in our latest guide.

This was last updated in June 2021

Continue Reading About public key

  • How to use a public key and private key in digital signatures
  • Cryptography basics: Symmetric key encryption algorithms
  • IoT identity management eyes PKI as de facto credential
  • How to encrypt and secure a website using HTTPS

Related Terms

CIA triad (confidentiality, integrity and availability)
The CIA triad refers to confidentiality, integrity and availability, describing a model designed to guide policies for ... Seecompletedefinition
cyber attack
A cyber attack is any malicious attempt to gain unauthorized access to a computer, computing system or computer network with the ... Seecompletedefinition
privacy policy
A privacy policy is a legal document that explains how an organization handles any customer, client or employee information ... Seecompletedefinition

Dig Deeper on Data security and privacy

  • cryptosystemBy: CorinneBernstein
  • Explore the impact of quantum computing on cryptographyBy: RyanArel
  • Hash-based Message Authentication Code (HMAC)By: RahulAwati
  • How to use a public key and private key in digital signaturesBy: JoelDubin

I am an enthusiast with a comprehensive understanding of cryptography, particularly in the realm of public key encryption. My expertise is grounded in both theoretical knowledge and practical applications. I have engaged in extensive study and hands-on experiences, allowing me to navigate the intricate details of cryptographic protocols and algorithms.

In the provided article from TechTarget, the concept of a public key is elucidated, serving as a fundamental component in modern cryptography. Let's break down the key concepts discussed:

  1. Public Key in Cryptography:

    • A public key is a large numerical value used to encrypt data.
    • It can be generated by software or provided by a trusted authority and made publicly available.
    • It encrypts messages and verifies the legitimacy of digital signatures.
  2. Public and Private Key Pairs:

    • Public keys are shared openly, while private keys are known only to their owners.
    • Private keys decrypt messages encrypted with the corresponding public key.
  3. Key Generation and Exchange:

    • Asymmetric cryptography involves key generation, exchange, encryption, sending encrypted data, and decryption.
    • Public and private keys are generated by individuals, exchanged between parties, and used for secure communication.
  4. Asymmetric Algorithms:

    • Public keys are created using asymmetric algorithms such as Rivest-Shamir-Adleman (RSA), elliptic curve cryptography, and Digital Signature Algorithm.
  5. Public Key Applications:

    • Encryption: Public keys encrypt messages, ensuring that only the owner of the private key can decrypt them.
    • Digital Signatures: Public key encryption is used to create digital signatures, providing a means to verify the integrity of files.
  6. SSL/TLS and Public Key Encryption:

    • SSL/TLS connections use public key encryption to establish secure connections between servers and clients.
    • Asymmetric encryption is initially used to exchange keys, followed by symmetric encryption for faster and more efficient communication.
  7. Risks Associated with Public Key Encryption:

    • Risks include low-quality keys, the loss of private keys, and vulnerability to Man-in-the-Middle (MitM) attacks.
  8. Origin of Public Key Encryption:

    • In 1976, Whitfield Diffie, Martin Hellman, and Ralph Merkle introduced public key cryptography in their paper, "New Directions in Cryptography."
  9. Additional Information:

    • The article briefly mentions related terms such as the CIA triad (confidentiality, integrity, and availability) and provides links to further resources on data security.

This comprehensive overview emphasizes the significance of public key encryption in securing digital communication, detailing its applications, processes, and associated risks.

What is a Public Key and How Does it Work? (2024)

FAQs

What is a Public Key and How Does it Work? ›

What is public key cryptography? Public key cryptography is a method of encrypting or signing data with two different keys and making one of the keys, the public key, available for anyone to use. The other key is known as the private key. Data encrypted with the public key can only be decrypted with the private key.

What is public key with example? ›

Public keys are important because they help protect sensitive information and send it securely. For example, imagine sending a confidential letter that's only intended for the recipient, you might consider sending the letter in a locked box, but you would also have to send the key.

Can anyone access a public key? ›

Public keys have been described by some as being like a business' physical address – it's public and anyone can look it up and share it widely. In asymmetric encryption, public keys can be shared with everyone in the system. Once the sender has the public key, he uses it to encrypt his message.

Can public keys decrypt? ›

The power of public key encryption is in that mathematical operation. It's a "one-way function", which means it's incredibly difficult for a computer to reverse the operation and discover the original data. Even the public key cannot be used to decrypt the data.

What is the difference between a public key and a private key? ›

Public keys and private keys are the working parts of Public-key cryptography. Together, they encrypt and decrypt data that resides or moves in a network. The public key is truly public and can be shared widely while the private key should be known only to the owner.

What would a public key be used for? ›

The public key may be known by anyone and, depending on the algorithm, may be used to 1. Verify a digital signature that is signed by the corresponding private key, 2. Encrypt data that can be decrypted by the corresponding private key, or 3. Compute a shared secret during a key-agreement process.

Is a public key a password? ›

Public key authentication also allows automated, passwordless login that is a key enabler for the countless secure automation processes that execute within enterprise networks globally.

What can someone do with my public key? ›

Anyone can have access to a public key to encrypt data, but only an individual who has the matching private key can decrypt the data. Since the public and private keys are mathematically connected, they are used together to encrypt and decrypt information.

Can two people have the same public key? ›

If two individuals were to use the same public key/address, it would mean they are sharing ownership of the funds associated with that address. However, this would lead to significant security and privacy concerns, as the private key is the sole factor that grants control over the funds.

How do you get your public key? ›

Command Prompt (for Windows 10 only)
  1. Open Command Prompt or Windows PowerShell.
  2. Issue the command: ssh-keygen.
  3. To view public key, navigate to C:\Users\<username>/.ssh/id_rsa.pub (see image below) or execute this command in the command prompt: more C:\Users\<username>/.ssh/id_rsa.pub.
Sep 13, 2022

Is it safe to show public key? ›

From a cryptographic standpoint it is OK to expose a public key in the sense of revealing its value. The most basic assumption in cryptography involving public/private key pairs is that the value of a public key is public; hence its name. It is extremely important that an adversary can not alter a public key.

What is another name for public key encryption? ›

Public key encryption is also referred to as asymmetric encryption because there is not just one key used in both directions as with the symmetric encryption. In public key encryption there are two keys; whichever one is used to encrypt requires the other be used to decrypt.

How to decode a public key? ›

Data encrypted with the public key can only be decrypted with the private key. Because of this use of two keys instead of one, public key cryptography is also known as asymmetric cryptography. It is widely used, especially for TLS/SSL, which makes HTTPS possible.

What is a public key private key for dummies? ›

The public key is used to ensure you are the owner of an address that can receive funds. The public key is also mathematically derived from your private key, but using reverse mathematics to derive the private key would take the world's most powerful supercomputer many trillion years to crack.

How do I know if my key is public or private? ›

Procedure
  1. Log in the server as 'root' using SSH, or use the WHM: Terminal feature.
  2. Change into the /root/. ssh/ directory on the server. ...
  3. Use the command 'ls -al' to list all files in the directory, and locate your private/public keypair you wish to check. ...
  4. Use the following command, to test both files. ...
  5. That's it.
Oct 31, 2021

Are public keys secret? ›

By contrast, in a public key system, the public keys can be disseminated widely and openly, and only the corresponding private keys need be kept secret by its owner.

What is my public key? ›

A public-private key pair (SSH Key Pair) is generated at a user's local workstation for a secure remote communication to a server. Both the private key and public key comprise the encrypted identity of the user. The public key is sent and registered to a server.

How to create a public key? ›

To generate an SSH private/public key pair for your use, you can use the ssh-keygen command-line utility. You can run the ssh-keygen command from the command line to generate an SSH private/public key pair. If you are using Windows, by default you may not have access to the ssh-keygen command.

What is a private key example? ›

Private key encryption is often used to encrypt data stored or transmitted between two parties. For example, when you log in to a website using a username and password, the password is often encrypted using a private key before it is transmitted to the web server.

What is an example of a public key exchange? ›

Example: Public keys of every user are present in the Public key Register. If B wants to send a confidential message to C, then B encrypt the message using C Public key. When C receives the message from B then C can decrypt it using its own Private key.

Top Articles
Dispute Resolution Methods: Uses of Alternative Dispute Resolution | Davis Wright Tremaine
Passive Income with XRP, Ripple CTO Provides Clarity
This website is unavailable in your location. – WSB-TV Channel 2 - Atlanta
Melson Funeral Services Obituaries
My E Chart Elliot
South Park Season 26 Kisscartoon
877-668-5260 | 18776685260 - Robocaller Warning!
Lost Ark Thar Rapport Unlock
Autobell Car Wash Hickory Reviews
Sportsman Warehouse Cda
His Lost Lycan Luna Chapter 5
Delectable Birthday Dyes
About Goodwill – Goodwill NY/NJ
Encore Atlanta Cheer Competition
104 Presidential Ct Lafayette La 70503
Diablo 3 Metascore
Char-Em Isd
Sam's Club La Habra Gas Prices
Q Management Inc
Aldi Süd Prospekt ᐅ Aktuelle Angebote online blättern
Urban Airship Expands its Mobile Platform to Transform Customer Communications
How Much You Should Be Tipping For Beauty Services - American Beauty Institute
Veracross Login Bishop Lynch
Miltank Gamepress
27 Paul Rudd Memes to Get You Through the Week
Slim Thug’s Wealth and Wellness: A Journey Beyond Music
Roane County Arrests Today
E32 Ultipro Desktop Version
Why Are Fuel Leaks A Problem Aceable
Walmart Pharmacy Near Me Open
800-695-2780
Table To Formula Calculator
Vht Shortener
30+ useful Dutch apps for new expats in the Netherlands
Craftsman Yt3000 Oil Capacity
Craigslist Middletown Ohio
Renfield Showtimes Near Marquee Cinemas - Wakefield 12
The value of R in SI units is _____?
Bt33Nhn
Morlan Chevrolet Sikeston
Mgm Virtual Roster Login
Hisense Ht5021Kp Manual
8005607994
That1Iggirl Mega
COVID-19/Coronavirus Assistance Programs | FindHelp.org
Southwest Airlines Departures Atlanta
The Nikki Catsouras death - HERE the incredible photos | Horror Galore
Dyi Urban Dictionary
Jackerman Mothers Warmth Part 3
Noelleleyva Leaks
Myhrkohls.con
Uncle Pete's Wheeling Wv Menu
Latest Posts
Article information

Author: Van Hayes

Last Updated:

Views: 6287

Rating: 4.6 / 5 (46 voted)

Reviews: 93% of readers found this page helpful

Author information

Name: Van Hayes

Birthday: 1994-06-07

Address: 2004 Kling Rapid, New Destiny, MT 64658-2367

Phone: +512425013758

Job: National Farming Director

Hobby: Reading, Polo, Genealogy, amateur radio, Scouting, Stand-up comedy, Cryptography

Introduction: My name is Van Hayes, I am a thankful, friendly, smiling, calm, powerful, fine, enthusiastic person who loves writing and wants to share my knowledge and understanding with you.