# Public Key Encryption

When the two parties communicate to each other to transfer the intelligible or sensible message, referred to as plaintext, is converted into apparently random nonsense for security purpose referred to as ciphertext.

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.

Once the ciphertext is produced, it may be transmitted.

**The security of conventional encryption depends on the major two factors:**

- The Encryption algorithm
- Secrecy of the key

The 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.

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**.

**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 key (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.

**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:**

- Confidentiality can be achieved using Public Key Encryption. In this the Plain text is encrypted using receiver public key. This will ensures that no one other than receiver private key can decrypt the cipher text.
- 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 pubic key only.
- This algorithm can use in both Key-management and securely transmission of data.

Don’t stop now and take your learning to the next level. Learn all the important concepts of Data Structures and Algorithms with the help of the most trusted course: DSA Self Paced. Become industry ready at a student-friendly price.

## Recommended Posts:

- Know your public and private IP addresses
- Difference between Private key and Public key
- Difference between Private and Public IP addresses
- RC5 Encryption Algorithm
- RC4 Encryption Algorithm
- What is E2EE(End to End Encryption)?
- Difference between Encryption and Decryption
- Encryption, Its Algorithms And Its Future
- Data encryption standard (DES) | Set 1
- ElGamal Encryption Algorithm
- Difference Between Symmetric and Asymmetric Key Encryption
- Strength of Data encryption standard (DES)
- Knapsack Encryption Algorithm in Cryptography
- End to End Encryption (E2EE) in Computer Networks
- Image encryption using cellular automata

If you like GeeksforGeeks and would like to contribute, you can also write an article using contribute.geeksforgeeks.org or mail your article to contribute@geeksforgeeks.org. See your article appearing on the GeeksforGeeks main page and help other Geeks.

Please Improve this article if you find anything incorrect by clicking on the "Improve Article" button below.