Explain HTTPS with Cowherd and Weaver Girl

Time:2021-9-8

preface

This paper attempts to use Cowherd and weaver girl to explain HTTPS.

Information exchange and transmission have existed since ancient times, but the transmission conductor and exchange mode are constantly changing. Modern information transmission is carried out through the network. The steps of information transmission are simplified: Packaging — > transmission — > unpacking. Protocols such as HTTP specify the standard of information transmission, and information transmission generally mainly considers the following two aspects.

  • Reliability (passed to half lost?)
  • Security (blocked and modified by others)

This paper mainly discusses the security of transmission. As we all know, HTTPS is the secure version of HTTP. Let’s take a look at how to ensure the security of information transmission in ancient times.

Flying Pigeon biography

In the age when communication was not very developed, flying pigeons were a very effective way to deliver books.

Cowherd and Weaver Girl belong to long-distance love. Their daily communication is to transmit love letters through carrier pigeons. In the transmission process, information security is very important. If you are accidentally known by the queen mother, you will be in trouble. So Niulang began to study a set of security protocols. He thought of the following ways:

Plaintext transmission

Directly write “< U >I’m at the gate of Niujia village< / u > “love letter sent to weaver girl. The security of this way is very low. Once the Queen Mother intercepts the pigeon and gets the love letter, everything will be lost.

Key encryption

Encrypt the content of the love letter before delivering it:

  • Create key “< U >7354126< / u > “and send it to weaver girl;
  • Making ciphertext “< U >I’m at the door of koniu village< / u > “sent to weaver girl;
  • After receiving the ciphertext, the Weaver Girl decrypts it with a key“<u> I’m at the gate of Niujia village < / u >”。

The disadvantage of this method is that when the key is transmitted, it will be intercepted by the queen mother and the information will be leaked.

Note: Niulang’s encryption method is called in the computerSymmetric encryption(AES)

Package locking

For key encryption improvement, new communication methods:

  • The cowherd first sends an empty message to the weaver girl to let her know that she wants to send a message;
  • Then the weaver girl will send a locked box to the Cowherd and keep the key by herself;
  • After receiving the box, the cowherd put the written love letter in the box, locked it and sent it to the weaver girl;
  • After receiving the box, the weaver girl opened it with a key and got the love letter.

This method has a disadvantage. In the second step, the Queen Mother intercepts the empty box sent by the weaver girl to the cowherd, and then makes some hands and feet in it. The cowherd is very dangerous after receiving it.

Note: the above encryption method is called in the computerAsymmetric encryption(RSA), the box is likePublic keyFor encryption, the key isPrivate keyFor decryption.

Box seal

In order to prevent the queen mother from intercepting the box, the weaver girl decided to seal the box before sending it. In this way, when the cowherd receives the box, he first checks whether the box has been passive, and then puts the love letter into the box to lock and send it after confirming that it is safe.

It seems safe after this, but the seal is also likely to be forged. How can the cowherd be sure that the seal is made by the weaver girl? So they found Yuelao and asked Yuelao to seal her instead of weaver girl. They all trust Yuelao because he will seal the weaver only after confirming her identity. In this way, when the cowherd receives the box, it will be no problem if the seal is made by Yuelao and is trustworthy.

Note: Yuelao mentioned above is actually a websiteCertification authorityCA for short.

After a while, the pigeons began to strike because it was very tired to fly around with boxes every day. So Niulang revised the communication protocol and got the final version.

When the cowherd wants to communicate with the Weaver Girl:

  1. The cowherd sends an empty message to the weaver girl;
  2. The weaver girl received the message, prepared the box and passed the month old seal;
  3. Niulang receives the box and generates itsecret keyPut it in the box, lock it and send it to the weaver girl;
  4. The weaver girl received the box and opened it with a keysecret keypreservation;
  5. Now the cowherd can use itsecret keyEncrypt the love letter and send it to weaver girl. No longer use the box lock.

Summary

To fully understand the HTTPS protocol itself is complex, which involves a lot of professional communication knowledge and cryptography knowledge. This paper aims to simplify and explain its communication model.

Welcome to leave a message!