Internet Cryptography Part 1: Keys

by Viktor Hansson on 26 November 2015, 21:41

Tags: SSL TLS Certificate HTTPS internet_cryptography


Lets just start from the absolute basics, and then work our way up to the actual tools for working with this stuff.

What is cryptography? Well, it's quite simple actually. Cryptography is the practice of securing a message, so that only the intended recipiant of the message can read it. An example would be that you write a letter describing the location of all your hidden gold which you need to send to your family. If you don't encrypt the letter, then the mailman could read it before delivering it, and then go and steal your precious gold.

What you need to know is that there are two types of encryption: symmetric and asymmetric. You don't need to understand how these types actually encrypt stuff, and neither do you need to understand why they're named as they are. But you do need to understand the difference between them.

Symmetric
Imagine a box with a lock. You need the key that fits the lock to actually unlock the box, but you also need the key to lock the box. And finally there is only one key that fits the lock. If we go back to the letter about the gold. One type of physical encryption would be to place the letter inside the box, and then mail the box. This way the mailman would not be able to read the letter.
This does however present another problem. How would your family unlock it, since you have the key? One way would be to meet them face to face and hand them a copy of the key. Then you know that there are only two keys, one for you to lock the box, and one for your family to unlock the box. But if you cannot meet face to face, then exchanging the key becomes more difficult. You could send it in the mail, but then the mailman could just make a copy of it before delivering it.

In this analogy the lockbox key represents the cryptographic key.

Asymmetric
Now imagine a different kind of lockbox. This has no built-in lock, but instead the ability to lock it with a padlock.
In this scenario, the first step is for your family to send an unlocked padlock to you, while they keep the key. Since the padlock by itself has no information which could be used to unlock it, it's safe to send it via the evil mailman. Once you get the padlock, you use it to lock the box containing the letter. The box is then sent to your family, at which point they can use the key to unlock it. This way there is only one key, and it never leaves the safety of your family home.

And in this analogy the key represents the private key, and the padlock is the public key. These two terms are going to be used heavily throughout the series. 

Although there is one caveat to the above analogy. Where as a the padlock can be unlocked by anyone and only unlocked by the one posessing the key, both the private and public can be used to encrypt and decrypt. The public key can decrypt anything that has been encrypted by the private key, and vice verse.

About Me

This is my personal blog where I might write some interesting stuff. I have some examples of 3D javascript/webgl things in the works which should be done in the comming months, so be sure to return somewhat regularely.

Featured

Internet Cryptography Series

See also...

Blankycan
Terali
Andréas Söderberg