# What is public key cryptography

**Rate This Article:**

**What is Public Key Cryptography?**

Julius Caesar once sent a secret message to one of his generals. The plaintext message said "wait until reinforcements arrive, then attack." But it was encrypted with a key. So the ciphered message that the general read was "bfny ktw wjnsk twhjr jsyx ymjs fyyfhp." The original message was encrypted. The alphabet was shifted by 5 letters to the right. That is the key.

But here is the problem. Do you send the key with the message? If the message and key are with the same person, then capturing the person not only captures the message, but how to break the cipher. If you send the message with out the key, what happens if you never get the key, then the message can't be deciphered.

Public key cryptography is all about sending a message separately from the key.

**How can you send a message with out sending the key?**

Imagine that Alice and Bob line in a country where the postal service is completely immoral, and postal employees will read any unprotected correspondence. One day, Alice wants to send an intensely personal message to Bob. She puts it inside a padlocked box in the post, sends it to Bob and keeps the key. However, when the box reaches Bob, he is unable to open it because he doesn't have the key. Alice might consider putting the key inside another box, padlocking it and sending it to Bob, but without the key to the second padlock he is unable to open the second box, so he cannot obtain the key that opens the first box.

The only way around the problem sees to be for Alice to make a copy of her key and give it to Bob in advance when they meet for coffee. So far, I have just restated the same old problem in a new scenario. You still have a key distribution problem.

Avoiding key distribution seems logically impossible - If Alice wants to lock something in a box so that only Bob can open it, she must give him a copy of the key. Or, in terms of cryptography, if Alice wants to encipher a message so that only Bob can decipher it, she must give him a copy of the key. Key exchange seems to be an inevitable part of encipherment ... or is it?

## Scenario #2

Ok, now picture the following scenario. Alice still wants to send a personal message to Bob. Again, she puts her secret message in a box, padlocks it and sends it to Bob. When the box arrives, Bob adds his own padlock and sends the box back to Alice. When Alice receives the box, two padlocks now secure it, She removes her own padlock, leaving just Bob's padlock to secure the box. Finally she sends the box back to Bob, and here is the crucial difference: Bob can now open the box because it is secure only with his own padlock, to which he alone has the key.This shows that* a secret message can be securely exchanged between two people without necessarily exchanging a key*. Key exchange in other words is not an inevitable part of cryptography.

**What is Public Key Cryptography****?**

Public key cryptography allows users to communicate securely without having prior access to a shared secret key. This is done by using a *pair* of cryptographic keys, called a **public key** and a **private key**, which are related to each other mathematically.

In this process the private key is always kept secret, while the public key can be widely distributed. So one key "locks" a lock; while the other is required to unlock it. And it should not be possible to deduce the private key of a pair given the public key.

In addition the following requirements should be part of the public key process.

- It should be easy to generate both the public and the private keys.
- The plaintext should be easy to encrypt and decrypt.
- The private key should be difficult to obtain from the public key.
- The ciphertext and the public key alone will not allow you to generate the plaintext message.

**How does public key cryptography work?**

You have two private keys and one public key. Alice uses her private key and the public key to create the cipher message. Bob uses his own private key and the public key to decipher the message. And this is important, Alice cannot use her private key to decipher the message. Bob cannot use his private key to create the cipher message.

**What are some applications of Public key cryptography?**

e-mail is a very common application when you want to send very sensitive information. Also if you want to transfer files, documents, financial information over the Internet, or even within your own network and you want it secure, you can use public key cryptography.