This is the second of four posts in which I discuss cryptography. If you read all four posts, you will understand the differences between symmetric and asymmetric cryptography, why the US government were against the spread of modern cryptography, how it has resulted in the first crypto war between code rebels (techno-libertarians) and the US government, and how you can easily protect your privacy using Pretty Good Privacy (PGP).

The topics of the four posts are:

- What is symmetric cryptography;
**What is asymmetric (public key) cryptography;**- The first crypto war between code rebels and the government;
- How to easily use PGP to protect your e-mail communication.

## What is asymmetric (public key) cryptography

In my previous post, I mentioned four disadvantages of symmetric cryptography. These disadvantages are:

- The secret key must be shared between sender and receiver, before messages can be exchanged safely, preferably over a secure channel.
- The secret key is in two separate places.
- The sender of the message must trust the receiver that he will not steal or copy the secret key.
- It is not scalable for, for example, e-commerce.

Soon after the publication of the Data Encryption Standard (DES), asymmetric (public key) cryptography was invented by the Stanford graduate student, Whitfield Diffie, and Stanford Professor, Martin Hellman. This was a huge revolution within cryptographic research, because up until then it was thought that there should always be a shared secret key for the communication between the sender and receiver. The main question that Diffie and Hellman were trying to solve was: how can you create secure communication over a unsecure channel, when two corresponding people have never had contact with one another and therefore have not yet been able to share secret keys with each other.

The solution, public key cryptography, was introduced by Diffie and Hellman in their paper, ‘New Directions in Cryptography’ (1976). It inspired more cryptographic research outside the circles of secret agencies. Soon after the first publication on public key cryptography, three young Professors at MIT, Ron Rivest, Adi Shamir and Leonard Adleman, developed the now famous RSA public key cryptosystem in 1977.

Public key cryptography works as follows. There are two separate keys that correspond mathematically with one another: the** public key** and the **private key**. The public key is used to *encrypt* a message, and can be shared to other people. The private key is used to *decrypt* a message, and should be kept secret. Public key cryptography is hence a *two way function*. Just by knowing someone’s public key, it’s not possible to find out the person’s private key.

In our below example,

- Alice would like to send a secret love message to Bob.
- Bob has a corresponding public an private key, and sends the public key over a unsecure channel to Alice.
- Alice uses Bob’s public key to encrypt her secret love message.
- Alice sends the secret love message to Bob.
- Bob uses the corresponding private key to decrypt the message and finds out that Alice loves him.

Doing so, you can have private correspondence over an unsecure channel. Actually, we’re using public key cryptography all the time. Whenever you see a green padlock in front of the URL bar, it means that the data you enter on the website is first encrypted before it’s sent out.

### Digital Signatures

Public key cryptography is not only used for the encryption and decryption of messages, but also for message authentication. If Alice would not have encrypted her message with Bob’s public key, but with her own private key, then the encrypted message can be decrypted with her public key. If you receive a message of John Locke and you’d like to know whether it’s really sent out by Locke, then you could look up his public key and use it to decrypt his message. If the result is plaintext, and assuming that Locke is the only person in the world who possesses the only private key that can produce the encrypted message, you can be sure that the message was sent by Locke. In other words: applying a private key to a message is the equivalent to putting a **digital signature**.

Digital signatures are particularly important, because they provide the following security aspects:

*Authentication*: it offers proof that the message comes from the right person.*Non-repudiation*: we cannot deny that the signee has sent it.*Data integrity*: the message cannot be altered after it has been signed.

Diffie and Hellman saw great potential for public key cryptography in the coming digital age. The US secret intelligence, however, were not happy with this development in cryptography and tried to prevent public use of this new cryptosystem. The standoff between privacy advocates of whom many were cryptographers and the US government is known as the first crypto war.

In part three of this series, we will discuss the crypto war. Eventually, at the end of the post series, you will be able to encrypt your e-mails using public key cryptography.