# Encryption

## Contents

## Key points

- Encryption means scrambling information using a mathematical formula, so that it cannot be read without being descrambled. This means the data can be sent over a network safely, as long as only the sender and receiver know how to descramble the data.
- On the web, the HTTPS protocol is used to send encrypted data.
- Encrypted data should be used when data is sensitive - all banking websites use encryption.
- Encryption can also be used on hard drives and other storage devices to make sure that the data can only be read by a user who has permission.
- Most encryption systems use a public and private key system (asymmetric encryption). A user has their own key stored safely on their computer, and generates a public key to send to their contacts. The contact can send a message back in encrypted form by using the public key, but it can only be decrypted by somebody who has the private key.
- Simpler encryption systems are symmetric. This means that the key to encrypt and decrypt a message is the same. This is not as safe as a using a public and private key.

## Information

### Encryption

**Encryption** is used to hide sensitive messages from illegitimate recipients by using encryption algorithms and an encryption key to convert plain text to cipher text, illegible to those without the encryption and decryption key.

#### Symmetric Encryption

A simple encryption method is symmetric encryption. This means a key is shared between two people, and used to encrypt and decrypt messages.

Imagine that Alice wishes to share a message with Bob, but doesn't want anyone else to read the message. Alice encrypts the message using a private key. As long as Bob knows the same key, he can decrypt the message and read it.

There is a clear down-side to this approach. The key must be shared between the two people, but passed between the two in a way that it cannot be intercepted (such as in person).

No form of encryption was found to avoid this until 1976, when asymmetric encryption, using a public and private key, was invented.

### Public/private key encryption

**Private/Public key encryption** is when both parties have a pair of keys, one private and one public. The Public Key is kept in the open freely usable by anyone as is the encryption algorithm, however the Private Key is kept hidden.

Imagine that Bob wishes to send a message to Alice, but they cannot meet. He must somehow pass her a message telling her the key to his encrypted messages, without the key itself being read.

To do this, Alice must provide Bob with a public key. By using this public key, Bob can encrypt the message, but there's a catch: the public key doesn't *decrypt* the message. This means nobody can decrypt the message if they know Ailce's public key. Instead, Alice has her own private key that nobody else has seen. This decrypts and message encrypted with his public key.

So Bob uses Alice's freely available public key to encrypt a message. Alice uses her own private key to decrypt it. The encrypted message could contain a key, and from then on, simple symmetric encryption could take place.

## Videos