The Wayback Machine - https://web.archive.org/web/20241117023121/https://www.geeksforgeeks.org/public-key-encryption/
Open In App

Public Key Encryption

Last Updated : 24 Jun, 2024
Summarize
Comments
Improve
Suggest changes
Like Article
Like
Save
Share
Report
News Follow

Public key cryptography provides a secure way to exchange information and authenticate users by using pairs of keys. The public key is used for encryption and signature verification, while the private key is used for decryption and signing. When the two parties communicate with each other to transfer the intelligible or sensible message, referred to as plaintext, is converted into apparently random unreadable for security purposes referred to as ciphertext. 

What is Public Key Cryptography?

Public key cryptography is a method of secure communication that uses a pair of keys, a public key, which anyone can use to encrypt messages or verify signatures, and a private key, which is kept secret and used to decrypt messages or sign documents. This system ensures that only the intended recipient can read an encrypted message and that a signed message truly comes from the claimed sender. Public key cryptography is essential for secure internet communications, allowing for confidential messaging, authentication of identities, and verification of data integrity.

What is a Cryptographic Key?

A cryptographic key is a piece of information used by cryptographic algorithms to encrypt or decrypt data, authenticate identities, or generate digital signatures. It serves as a parameter to control cryptographic operations, ensuring the security and privacy of digital communications and transactions.

How Does TLS/SSL Use Public Key Cryptography?

TLS/SSL uses public key cryptography to keep our internet connections secure. It does this in two main ways:

  1. Encryption: When you visit a secure website (HTTPS), TLS/SSL helps encrypt data exchanged between your browser and the website’s server. It uses a combination of public and private keys to create a secure connection. Your browser and the server agree on a secret key for this session, which keeps your data safe from eavesdroppers.
  2. Authentication: TLS/SSL verifies the identity of websites. When you connect to a site, it presents a digital certificate signed by a trusted authority. Your browser checks this certificate to ensure you’re really connecting to the right site and not a fake one trying to steal your information.

By using public key cryptography, TLS/SSL protects our privacy online and ensures that the websites we visit are genuine and trustworthy.

Encryption

The process of changing the plaintext into the ciphertext is referred to as encryption. 
The encryption process consists of an algorithm and a key. The key is a value independent of the plaintext. 
 
The security of conventional encryption depends on the major two factors

  1. The Encryption algorithm
  2. Secrecy of the key

Once the ciphertext is produced, it may be transmitted. The Encryption algorithm will produce a different output depending on the specific key being used at the time. Changing the key changes the output of the algorithm. 
Once the ciphertext is produced, it may be transmitted. Upon reception, the ciphertext can be transformed back to the original plaintext by using a decryption algorithm and the same key that was used for encryption. 

Decryption

The process of changing the ciphertext to the plaintext that process is known as decryption. 

Public Key Encryption :  Asymmetric is a form of Cryptosystem in which encryption and decryption are performed using different keys-Public key (known to everyone) and Private key (Secret key). This is known as Public Key Encryption.

Difference Between Encryption and Public-Key Encryption

    Basis                             Encryption                                         Public-Key Encryption
Required for Work
  • Same algorithm with the same key is used for encryption and decryption.
  • The sender and receiver must share the algorithm and key.
  • One algorithm is used for encryption and a related algorithm decryption with pair of keys, one for encryption and other for decryption.
  • Receiver and Sender must each have one of the matched pair of keys (not identical) .
Required for Security
  • Key must be kept secret.
  • If the key is secret, it is very impossible to decipher message.
  • Knowledge of the algorithm plus samples of ciphertext must be impractical to determine  the key.
  • One of the two keys must be kept secret.
  • If one of the key is kept secret, it is very impossible to decipher message.
  • Knowledge of the algorithm plus one of the keys plus samples of ciphertext must be impractical to determine the other key.

Characteristics of Public Encryption key

  • Public key Encryption is important because it is infeasible to determine the decryption key given only the knowledge of the cryptographic algorithm and encryption key.
  • Either of the two keys (Public and Private key) can be used for encryption with other key used for decryption.
  • Due to Public key cryptosystem, public keys can be freely shared, allowing users an easy and convenient method for encrypting content and verifying digital signatures, and private keys can be kept secret, ensuring only the owners of the private keys can decrypt content and create digital signatures.
  • The most widely used public-key cryptosystem is RSA (Rivest–Shamir–Adleman). The difficulty of finding the prime factors of a composite number is the backbone of RSA.

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. No other recipient other than C can decrypt the message because only C know C’s private key. 

Public Key Encryption

Public Key Encryption

Components of Public Key Encryption

  • Plain Text:  This is the message which is readable or understandable. This message is given to the Encryption algorithm as an input.
  • Cipher Text: The cipher text is produced as an output of Encryption algorithm. We cannot simply understand this message.
  • Encryption Algorithm: The encryption algorithm is used to convert plain text into cipher text.
  • Decryption Algorithm: It accepts the cipher text as input and the matching key (Private Key or Public key) and produces the original plain text
  • Public and Private Key: One key either Private key (Secret key) or Public Key (known to everyone) is used for encryption and other is used for decryption

Weakness of the Public Key Encryption

  • Public key Encryption is vulnerable to Brute-force attack.
  • This algorithm also fails when the user lost his private key, then the Public key Encryption becomes the most vulnerable algorithm.
  • Public Key Encryption also is weak towards man in the middle attack. In this attack a third party can disrupt the public key communication and then modify the public keys.
  • If user private key used for certificate creation higher in the PKI (Public Key Infrastructure) server hierarchy is compromised, or accidentally disclosed, then a “man-in-the-middle attack” is also possible, making any subordinate certificate wholly insecure. This is also the weakness of public key Encryption.

Applications of the Public Key Encryption

  • Encryption/Decryption:  Confidentiality can be achieved using Public Key Encryption. In this the Plain text is encrypted using receiver public key. This will ensure that no one other than receiver private key can decrypt the cipher text.
  • Digital signature:  Digital signature is for senders authentication purpose. In this sender encrypt the plain text using his own private key. This step will make sure the authentication of the sender because receiver can decrypt the cipher text using senders public key only.
  • Key exchange: This algorithm can use in both Key-management and securely transmission of data.

Conclusion5

Public key encryption is a powerful method for securing our digital communications. It uses two keys, a public key, which is shared openly, and a private key, which is kept secret. This system allows us to send encrypted messages and verify the authenticity of digital signatures without sharing secret keys beforehand. It’s used widely in HTTPS for secure web browsing, email encryption, and digital signatures. Public key encryption keeps our online transactions safe and ensures that our private information remains confidential.

Frequently Asked Questions on Public Key Encryption – FAQ’s

What is the public key encryption?

Public key cryptography is a way to keep information safe by using two keys: a public key and a private key. The public key is shared with everyone, while the private key is kept secret. When someone encrypts data with the public key, only the holder of the private key can decrypt it. This method ensures that messages can be securely sent and received, protecting sensitive information online.

What is the difference between public and private key encryption?

The public key is like a lock that anyone can use to secure a message for the owner of the private key. It’s safe to share with everyone. The private key works like a special key that only the owner keeps secret. This key unlocks and reads the encrypted message.

How to generate a public key?

To create an SSH private and public key pair for your use, you can use a command-line tool called ssh-keygen. You can run this command from your terminal or command prompt. If you’re using Windows, the ssh-keygen command might not be available by default.



Previous Article
Next Article

Similar Reads

Difference between Software Encryption and Hardware Encryption
Encryption is a vital component in securing digital information, and it can be implemented in two primary ways: the first type is known as software encryption while the other type is referred to as hardware encryption. As signified earlier, both means are used to safeguard data by encoding it in such a way that any other person who intends to acces
9 min read
Difference Between Homomorphic Encryption and End-to-End Encryption
Homomorphic Encryption and End-to-End Encryption are two ways to protect data. Homomorphic Encryption allows computations on encrypted data without needing to decrypt it first. End-to-End Encryption, on the other hand, makes sure that only the sender and receiver can read the messages, keeping them safe during transmission. What is Homomorphic Encr
3 min read
Difference between Private key and Public key
Cryptography as a field emphasizes the need to guarantee secure communication and data privacy. There are mainly two approaches available to perform this operation: – Private Key Cryptography (RIC or Symmetric Key Cryptography) and Public Key Cryptography (PKE or Asymmetric Key Cryptography). Although they are used to protect information, they work
6 min read
Simplified Data Encryption Standard Key Generation
Simplified Data Encryption Standard (S-DES) is a simple version of the DES Algorithm. It is similar to the DES algorithm but is a smaller algorithm and has fewer parameters than DES. It was made for educational purposes so that understanding DES would become simpler. It is a block cipher that takes a block of plain text and converts it into ciphert
3 min read
Difference Between Symmetric and Asymmetric Key Encryption
Encryption is one of the most basic concepts in the world of cybersecurity as it ensures that some information does not fall into the wrong hands. There are two primary types of encryption techniques: In encryption techniques, there are two types, namely symmetric key encryption and asymmetric key encryption. Anyone involved in data security must k
4 min read
Public Key Infrastructure
Public key infrastructure or PKI is the governing body behind issuing digital certificates. It helps to protect confidential data and gives unique identities to users and systems. Thus, it ensures security in communications. The public key infrastructure uses a pair of keys: the public key and the private key to achieve security. The public keys ar
7 min read
End to End Encryption (E2EE) in Computer Networks
What is Encryption? Have you ever wondered how our emails, texts, photos, videos are sent over the Internet? Whenever you send anything over the Internet, it passes through a lot of servers, routers, and other devices where anyone can intercept it and get access to your private information. Thus, to tackle such mishap, encryption was introduced. In
2 min read
Strength of Data encryption standard (DES)
Data encryption standard (DES) is a symmetric key block cipher algorithm. The algorithm is based on Feistel network. The algorithm uses a 56-bit key to encrypt data in 64-bit blocks. There are mainly two categories of concerns about the strength of Data encryption standard. They are: Concerns about the particular algorithm used. Concerns about the
2 min read
What is E2EE(End to End Encryption)?
E2EE or End to End Encryption refers to the process in which encryption of data are being done at the end host. It is an implementation of Asymmetric encryption and hence ensures a secure way of data communication. It is the most secure way to communicate privately and securely as data can be read-only by the sender and the receiver. No one else ca
3 min read
Conventional Encryption
Conventional encryption is a cryptographic system that uses the same key used by the sender to encrypt the message and by the receiver to decrypt the message. It was the only type of encryption in use prior to the development of public-key encryption. It is still much preferred of the two types of encryption systems due to its simplicity. It is a r
3 min read
Simplified Data Encryption Standard | Set 2
Prerequisite - Simplified Data Encryption Standard | Set 1 Simplified Data Encryption Standard is a simple version of Data Encryption Standard having a 10-bit key and 8-bit plain text. It is much smaller than the DES algorithm as it takes only 8-bit plain text whereas DES takes 64-bit plain text. It was developed for educational purpose so that und
13 min read
Encryption, Its Algorithms And Its Future
Encryption is very important in today's world, it is the process of transforming plaintext into ciphertext to maintain data security, and it is a crucial tool used in modern cyber security. It secures sensitive data by rendering it unreadable to unauthorized events, making sure of confidentiality, integrity, and authenticity. What is Encryption?Enc
6 min read
What is Data Encryption?
Data Encryption is an important part of preserving data integrity, and confidentiality, its importance cannot be overestimated. Almost the whole thing on the internet has been encrypted at some point. In this article, we will discuss data encryption and its importance. What is Data Encryption?Data Encryption is a method of preserving data confident
9 min read
Why is Encryption Important in Securing Data Transmission Over Networks?
Answer: Encryption is basically important for securing data transmission over Networks, because it makes shows that sensitive information remains private and inaccessible to unauthorized users.Below are the reasons specifying why encryption important in securing data transmission over networks: ConfidentialityEncryption process encodes the data int
2 min read
Encryption vs Hashing vs Salting
Data Integrity and Privacy form the building blocks of cybersecurity. These three core techniques- encryption, hashing, and salting, are considered to be the most important ones when it comes to the security of digital data. This is done to protect data during the process of storage and transmission, but they altogether play different roles and use
5 min read
Twofish Encryption Algorithm
When it comes to data protection, encryption methods act as our buffering agents. One example of an excellent block cipher is the Twofish encryption algorithm. Although it was a competitor of another block cipher in the Advanced Encryption Standard competition and was later succeeded by the latter, it can still be used as a safe approach to protect
6 min read
How Does Wi-Fi Encryption Enhance Network Security?
Answer: Wireless security consists of encryption, authentication, access control, device security, access control, etc. It creates a layer of protection. The process starts by enabling the wireless network encryption method (such as WPA2 or WPA3) to block data transmission. Unauthorized people cannot read the data even if they are intercepted. Acce
2 min read
RC5 Encryption Algorithm
RC5 is a symmetric key block encryption algorithm designed by Ron Rivest in 1994. It is notable for being simple, fast (on account of using only primitive computer operations like XOR, shift, etc.) and consumes less memory. Example: Key : 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00Plain Text : 00000000 00000000Cipher Text : EEDBA521 6D8F4B15RC5
9 min read
Knapsack Encryption Algorithm in Cryptography
Knapsack Encryption Algorithm is the first general public key cryptography algorithm. It was developed by Ralph Merkle and Mertin Hellman in 1978. As it is a Public key cryptography, it needs two different keys. One is the Public key which is used for the Encryption process and the other one is the Private key which is used for the Decryption proce
6 min read
Encryption vs Digest in Cryptography
Encryption and Digest algorithms are used prominently in cryptography to protect the information which is always in high demand. Both are used as protection for data, however, their roles and capabilities of use are quite varied. Encryption replaces the normal or readable form of information (plaintext) with an unreadable form (ciphertext) to maint
6 min read
ElGamal Encryption Algorithm
ElGamal Encryption is a public-key cryptosystem. It uses asymmetric key encryption for communicating between two parties and encrypting the message. This cryptosystem is based on the difficulty of finding discrete logarithms in a cyclic group that is even if we know ga and gk, it is extremely difficult to compute gak. In this article, we will get t
6 min read
Advanced Encryption Standard (AES)
Advanced Encryption Standard (AES) is a specification for the encryption of electronic data established by the U.S. National Institute of Standards and Technology (NIST) in 2001. AES is widely used today as it is much stronger than DES and triple DES despite being harder to implement. In this article, we will cover the AES, the Working of Cipher an
8 min read
What is an Asymmetric Encryption?
Asymmetric encryption, also known as public-key cryptography, is a type of encryption that uses a pair of keys to encrypt and decrypt data. The pair of keys includes a public key, which can be shared with anyone, and a private key, which is kept secret by the owner. What is an Asymmetric Encryption?In asymmetric encryption, the sender uses the reci
8 min read
Difference Between Encryption and Encoding
Encryption and Encoding are terms often interchanged and used incorrectly, but they have distinct differences. Anyone dealing with communication networks or data security needs to be aware of these distinctions. In this article, we will learn the difference between the two terms, encryption and encoding. What is Encryption?It is a process used to c
4 min read
Difference between Hashing and Encryption
In the field of cybersecurity, encryption, and hashing are the two most basic methods utilized for the protection and integrity of data. Even though all these terms may be utilized to mean the same thing, they tend to work differently and for different purposes. As evidenced in encryption, data cannot be read in its encrypted form, hence making the
5 min read
Difference Between AES and RSA Encryption
In cryptography, this is the process of changing or transforming plain text or information into a cipher text or a text that the receiver, who is the person to whom the information is intended, can only decode. There are several algorithms in data encryption such as AES and RSA. AES represents a symmetric key algorithm whose processes depend on the
6 min read
Difference between Encryption and Cryptography
Encryption and Cryptography are the two terms that are generally used in Cyber Security. Encryption is the process in which the data should be securely locked which means only authorized users access the data while cryptography is the process of securing information or data by using cryptographic algorithms so that any hacker or unauthorized person
4 min read
Difference between Tokenization and Encryption
Tokenization is vital in data security to obscure information that should not be viewed and encryption is a significant strategy in security used to secure delicate data including credit card numbers, PII, and other sensitive information. The two techniques change the form of the information stored in a dataset to ensure that only authorized person
7 min read
Difference Between Data Encryption and Data Compression
Data Compression and Data Encryption are two important methods of protecting and managing data. While both of these processes can help protect your data, they work in different ways. In this article, we’ll discuss the key differences between data encryption and data compression, and explain how each can help you protect your data. What is Data Encr
5 min read
Difference between Encryption and Decryption
Encryption is the process of converting a normal message (plain text) into a meaningless message (ciphertext). Decryption is the process of converting a meaningless message (ciphertext) into its original form (plaintext). The major distinction between secret writing and associated secret writing is the conversion of a message into an unintelligible
4 min read
Article Tags :
three90RightbarBannerImg