Reading Time: 4 minutes

đź’ˇ TL, DR:

  • Public key is the tool to encrypt data before sending it to other recipients to protect it from unauthorized uses.
  • Only matching private keys can decrypt data from public keys.
  • Public keys can be shared with everyone.
  • Public keys are used in data encryption, digital signing, and SSL/ TLS connections.

Intro

Public keys and private keys are the most common terms used in cryptocurrency that every user must know right after entering the community. However, it is difficult for new crypto users to understand these terms correctly.

This article will explain the first term – public key – from the basics to help you understand this essential tool in the crypto space.

What is a public key?

a flow chart illustrating how public key works
Public key in a nutshell | Source: Wikipedia

First, let’s define what a public key is.

In cryptography, a public key is generated using asymmetric-key encryption algorithms and designed to encrypt data. The public key, generally paired with a private key, works to ensure the data is well-protected from outsiders. Only those who own the matching private key can decrypt the data and get the message.

This concept of public keys remains the same in cryptocurrencies.

At the first crypto session, each user will be provided a pair of keys, including the public key and the private key. The public key is publicly available, which means everyone can send transactions to it. However, you are only able to “own” the assets if you have the matching private key to “unlock” the transactions.

How a public key works

How public key works | Source: Wikipedia

The process of sending and receiving data by a key pair is complicated, but in general, we can break it down into 5 steps:

  1. Generate key: Through key generation program or application, each user will be given a public key and a private key.
  2. Exchange key: The sender and recipient exchange public keys for further data encryption and transaction execution.
  3. Encrypt data: By using the public key and a mathematical operation, the sender’s data is encoded.
  4. Send encrypted data: Senders will provide their public key to recipients and receivers need to use a matching private key to decode that information.
  5. Decrypt data: The recipients decrypt the given data with their private key to get the message or transaction from the sender.

Common applications of Public key’s encryption

Encryption

As mentioned above, encryption is the main function of public keys.

In the crypto economy, all information will be encrypted into codes that can only be analyzed and deciphered by keys to protect data privacy. Public keys are one part of that process: encrypting data into codes.

Digital signature

Have you ever heard about DSA – Digital Signature Algorithm? In short, it is addressed by the National Institute of Standards and Technology (NIST) as the substitution for written signatures. Until now, DSA has been accepted worldwide and used in many business and legal documents.

So, this is how the digital signature is formed using the public key:

  1. The sender identifies the files to be digitally signed.
  2. By using hashing algorithms (SHA-1 or MD5), the file has been analyzed and transferred into a string of unique hash values based on its contents.
  3. The sender’s private key encrypts the values and creates the digital signature.
  4. The original file and the digital signature will be delivered to the recipient.
  5. With the public key shared by the sender, receivers can decrypt the digital signature’s hash.
  6. The recipient’s device will read the original document’s hash values and compare them with the decrypted hash.
  7. If two values are perfectly matched, then the digital signature is confirmed. Otherwise, the signature won’t be verified and accepted.
The digital signing process | Source: Wikipedia

Transport Layer Security and Secure Socket Layer connections

Secure Socket Layer (SSL) and Transport Layer Security (TLS) use public key encryption features to form a secure connection between users and the server. This method is named Hypertext Transfer Protocol Secure (HTPS). Sounds familiar, right? That is the standard technology used by many websites worldwide.

Public key: Pros and Cons

Pros

  • Data protection

In the crypto economy, data is encrypted for privacy protection and public key is the tool to do it. Only matching private keys can access the data and decode it.

  • Non-repudiation

Digital signature signed by a public key is legally equivalent to a written signature. Senders cannot deny the information signed with their name. Such a feature will protect both parties’ rights in case some dispute happens later.

Cons

Despite having many big advantages, there are still some problems when using public keys that you must know:

  • Time-consuming process

Public key is just a term to refer to the process of encoding data using asymmetric encryption technology. Compared to symmetric encryption used in private keys, it takes a longer time to translate data with the asymmetric approach. Therefore, when working with a bulk database, users may have to wait quite long for the database to fully proceed.

  • Potential risks

As you publish your public key to everyone, hackers can steal your private key and read your data.

  • Independent execution unavailability:

As mentioned, public and private keys go in pairs. If you lose the private key to read encrypted data, then your public key is useless.

Public key vs. Private key – What are the differences?

Public and private keys go in pairs. Source: Antier Solutions

The table below will identify the basic differences between public key and private key:

Public keyPrivate key
PurposeUsed for encrypting dataUsed for decrypting data
AvailabilityAvailable to share to the publicPrivate to only sender
Technique usedApply asymmetric encryption methodApply symmetric encryption technique

If you still get interested about private keys and want to have a more in-depth understanding, read this post.

Final thoughts

That is all you need to learn about public keys before entering the crypto economy. In short, the public key is the tool to encrypt data and protect them from unauthorized use.