Before to star this article, you can read about encryption, symmetric encryption, and its algorithms.

Here, we will focus on asymmetric encryption.

**Private and puplic keys**

Asymmetric encryption applies ** two keys**. They are the public key and the private key. That is the reason why encryption is called asymmetric.

**encrypts the message. While**

*The public key***decrypts it. Thus, public and private keys are mathematically interconnected. With the help of certain mathematical functions, the public key is calculated from the value of the private key. You can send the public key via**

*the private key**unprotected (public) communication channels*. And without any risk involved. Meanwhile, the private key never leaves its owner. And the value of the private (secret) key can’t be calculated on the basis of the public one.

**How asymmetric encryption works**

Let’s imagine that Bob wants to send Alice a message.

* Alice has a secret key. So, she uses to calculate (generate) the public key. Then, she sends this public key to Bob.

* The attacker Eve sees this public key absolutely clear. And can even bring it to Bob. For Eve, this public key is absolutely useless.

* Bob receives the public key. And encrypts his message with it. Thus, the public key encryption works only in one direction. You are not capable of decrypting the message with this public key.

* Alice receives Bob’s encrypted message. And decrypts it with her secret key.

For clarity, we can give an example of a mailbox. So, Alice tells Bob the address of her house (the public key). On the door of which a mailbox hangs. Bob comes to Alice’s house, sees the mailbox. And puts the letter in it (encrypts it with the public key). It is impossible to get the letter back through the gap of the box (it is impossible to decrypt it). Alice comes home from work, opens the mailbox with her (secret) key. And she reads Bob’s letter.

**Mathematical basis and the back door**

The underlying basis of asymmetric encryption algorithms is the so-called one-way functions (or irreversible functions). Let’s have a little flashback on mathematics. A function is a correspondence between elements of two sets. Mathematically, the definition of the function is y = f (x). F is all those operations that determine how the value of y (the variable) depends on the value of x (the constant). For example, vehicle speed (f) determines how the distance traveled (y) depends on the time spent (x).

Asymmetric cryptography uses ** one-way functions with a back door**.

The irreversibility of the function is as follows:

It is easy to calculate y for any value of x. But if for most values of y, it is difficult to find x in an acceptable time, in such a way that y = f(x), then the function will be one-way.

An example of a one-way function that is used in asymmetric encryption algorithms is a multiplication of two large numbers, say N = P*Q. Imagine that you multiply P and Q having at least five characters on a calculator. And you get the resulting number N. Tell that number N to a friend. And then ask him to find the numbers P and Q which you have multiplied. You can be sure that your friend is unlikely to cope with this task. Even over several years! The process of fitting the multipliers P and Q for the value of N is called *factorization of the product of two large numbers.*

** A back door** is such a value of y, with which we can easily calculate x if we know the value of f(x). The back door is the secret key in asymmetric encryption which never leaves its owner and makes the function reversible.

This may seem like a can of worms. But there’s no need to worry if you haven’t got the full mathematical understanding of this.