The Wayback Machine - https://web.archive.org/web/20230317192240/https://www.geeksforgeeks.org/blockchain-public-key-cryptography/
Skip to content
Related Articles
Open in App
Not now

Related Articles

Blockchain – Public Key Cryptography

Improve Article
Save Article
  • Last Updated : 05 Jul, 2022
Improve Article
Save Article

Blockchain technology is one of the greatest innovations of the 21st century. In this article, we will focus on the concept of cryptography i.e. public-key cryptography or Asymmetric key cryptography.

Introduction To Public-Key Cryptography

Most of the time blockchain uses public-key cryptography, also known as asymmetric-key cryptography. Public key cryptography uses both public key and private key in order to encrypt and decrypt data. The public key can be distributed commonly but the private key can not be shared with anyone. It is commonly used for two users or two servers in a secure way.  

Public Key Cryptography

 

Public Key: Public keys are designed to be public. They can be freely given to everyone or posted on the internet. By using the public key, one can encrypt the plain text message into the cipher text. It is also used to verify the sender authentication. In simple words, one can say that a public key is used for closing the lock.

Private Key: The private key is totally opposite of the public key. The private key is always kept secret and never shared. Using this key we decrypt cipher text messages into plain text. In simple words, one can say that the public is used for opening the lock.

Why Do We Need Public-Key Cryptography?

  • In symmetric-key cryptography, a single key is used to encrypt and decrypt the message. Here, the possibility of data loss or unauthorized access to data is high. To overcome the unauthorized access of data and data sent securely without any loss, we use public-key cryptography.
  • Public-key cryptography is more secure than symmetric key cryptography because the public key uses the two keys to encrypt and decrypt the data
  • Public-key cryptography allows the users to hide the data that they want to send. The sender encrypts the data and the receiver decrypts the data. The encrypted message is not understood by unauthorized users.             

Working On Public-Key Cryptography

Suppose, the sender wants to send some important message to the receiver. 

  • The sender first creates a message in the form of plain text which is in a readable format.
  • The sender knows the public key of the receiver but doesn’t know the private key of the receiver because the receiver keeps secret his private key. With the help of the public key of the receiver and the private key of the sender, the sender generates the encrypted message i.e. called cipher text. Cipher text is in an unreadable format. In this step, plain text converts into cipher text.
  • Now, cipher text reaches the receiver end. The receiver knows its own private key, and with the help of the private key receiver converts the cipher text into readable format i.e. plain text.

The below example shows the working of public-key cryptography.

Public Key Cryptography

 

Let’s try to under the working of public-key cryptography with an example. Suppose Sachin is the sender who wants to send a message to Anurag. Here Anurag is the receiver. 

  • Sachin uses Anurag’s public key to encrypt the message and Anurag uses his own private key to decrypt the message.
  • First Sachin creates plain text. Sachin has access to Anurag’s private key and cipher text. Using Anurag’s public key and own public key,
  • Sachin will generate an encrypted message i.e. cipher text which is in an unreadable format. After applying the encryption process plain text converts into cipher text.  
  • Now, Anurag receives a cipher text. First Anurag will decrypt the cipher text message into a readable format. For decrypting Anurag will use the private key. Now cipher text converts into plain text and is readable by the receiver.  Because Sachin keeps his private key, Anurag knows that this message couldn’t have come from anyone else. This is also called a digital signature. 

Benefits of Public-key Cryptography

  • Authentication: It ensures to the receiver that the data received has been sent by the only verified sender.
  • Data integrity: It ensures that the information and program are changed only in a specific and authorized manner.
  • Data confidentiality: It ensures that private message is not made available to an unauthorized user. It is referred to as privacy or secrecy.
  • Non-repudiation: It is an assurance that the original creator of the data cannot deny the transmission of the said data to a third party.

Limitation of Public-Key Cryptography

  • One can encrypt and decrypt the fixed size of messages or data. If there is an attempt to encrypt or decrypt a large size of the message then the algorithm demands high computational power.
  • The main disadvantage of this algorithm is that if the receiver losses its private key then data/message will be lost forever.
  • If someone has access private key then all data will be in the wrong hand.
  • There are many secret-key which is faster than public-key cryptography.
My Personal Notes arrow_drop_up
Related Articles

Start Your Coding Journey Now!