## Encryption:

### What are the different encryption methods that exist?

There are tons of encryption algorithms. I will not introduce them all. It would require too much mathematical knowledge. If we can not know all the encryption algorithms, we must know that we can classify them into 2 categories: symmetric encryption and asymmetric encryption.

#### Symmetric encryption

This is the simplest encryption method. This does not mean that it is not robust (there are very safe symmetric encryptions). It means that the operation is simple to understand.
With this method, to encrypt a message we use a key (a secret password). For example, imagine that this key is "topsecret".
If the hacker intercepts an encrypted message, he can not do anything if he does not know the secret key!

Indeed, for the schema we just saw can work, it is necessary that the client and the server have previously communicated the magic key used to encrypt and decrypt. But how do they do to exchange it? If they send it in clear, the hacker will be able to intercept it and he will then be able to decrypt all the encrypted messages that will pass on the network!

Symmetric encryption is a powerful encryption, but it has a big flaw: it is necessary to communicate "discreetly" the encryption key ... but it is impossible: we must send the key in clear early! ... Less than ... no ... And why not ? If we encrypted the encryption key when it was sent?   To encrypt the symmetric encryption key, we will use another method: asymmetric encryption. With this other method we are not likely to find the same problem we just met.

#### Asymmetric encryption

Symmetric encryption uses a single key to encrypt and decrypt. Asymmetric encryption uses one key to encrypt and another to decrypt.   There are 2 keys:   A key called "public" which is used to encrypt.
A key called "private" which serves to decrypt.
The public key is only used to encrypt. With this type of algorithm, we can decrypt a message only if we know the private key.   The computer is asked to generate a pair of keys: a private and a public. They go together. Do not ask me how he generates them and why they go together, it's too complicated to explain. Just accept that the computer is capable of randomly generating a couple of keys that go together.   Let's take an example and imagine that:

• The public key is 74A48vXX.
• The private key is 99o0pn9.

To encrypt, we use the public key: To decrypt, the public key does not work. It is mandatory to use the private key:       That's why we say it's asymmetric encryption: you need 2 different keys. One of them allows to encrypt the message, the other to decrypt it. There is no other way.   The public key can be transmitted in clear on the network (it is "public"). It does not matter if a hacker intercepts it. On the other hand, the private key that decrypts must remain secret.   The best-known asymmetric encryption algorithm is called RSA. The best-known symmetric encryption algorithm is called AES and DES.