How HTTPS works – Explained in layman terms

栏目: IT技术 · 发布时间: 4年前

内容简介:Have you ever wondered what happens when you type any URL in the browser? Why few websites are on HTTPS while others on HTTP? When you purchase anything online using your credit card, how does a website ensure that your sensitive information is not leaked?

How HTTPS works – Explained in layman terms

https

Introduction

Have you ever wondered what happens when you type any URL in the browser? Why few websites are on HTTPS while others on HTTP? When you purchase anything online using your credit card, how does a website ensure that your sensitive information is not leaked? Same applies to the case when you enter login Id and password on any social media website.

In this article, I’ll be elaborating basic working of HTTP, its disadvantages and the basic building blocks of HTTPS. In the next article, I’ll be explaining the internals of https, SSL handshake & clear confusion between SSL, TLS & HTTPs.

Working of HTTP

When you type any URL in the browser, the browser acts like a client & the website behaves like a server. The client uses HTTP protocol and fetches information from the server. The server returns an HTML page which the browser then renders and displays it to the user. Following is an overview of the process:-

How HTTPS works – Explained in layman terms

Client-Server Model

To get more clarity, you can use the curl command to observe what request the client sends and how the server responds. Curl is a command-line utility and works similar to a browser (except rendering the HTML)

Let’s run the command — curl -X GET ‘https://airindia.com' -v

You will see the following output:-

How HTTPS works – Explained in layman terms

The output of curl -X GET ‘https://airindia.com' -v

As you can see, the IP Address of the website was first resolved and then an HTTP request was sent by the client. Following is the HTTP request sent:-

> GET / HTTP/1.1> Host: airindia.com> User-Agent: curl/7.58.0> Accept: */*

Disadvantages of HTTP

  • Message Integrity: When you are sending a message over HTTP, anyone on the network can see what message is being sent. Further, anyone can intercept the message, modify it and send it to the server. For eg:- If you are chatting with your friend & sending a message “ Hey, you are smart ”, someone can modify the message and send “ Hey, you are an idiot ”.

How HTTPS works – Explained in layman terms

Loss of Message Integrity
  • Confidentiality : If you are shopping online (HTTP website) and paying using credit card details, a hacker on the network can observe all the sensitive details sent to the website. The hacker can use your sensitive information and steal your money.

How HTTPS works – Explained in layman terms

Sniffing sensitive information

How HTTPS works – Explained in layman terms

Stealing information on the Internet
  • Authenticity: A browser must validate the identity of any website & trust it. For eg:- On foreign trips, Airport officials ask you for your passport to verify that it’s you and not someone else. Here, passport acts like an identity. To trust a website it must present an identity to the client. In HTTP communication, this is not possible. On entering URL of an HTTP website in the browser, you will see the following warning in the address bar:-

How HTTPS works – Explained in layman terms

Connecting to an HTTP website

HTTPs & its building blocks

HTTPs is secure HTTP. HTTPs guarantees that communication that takes place over HTTP is encrypted. It overcomes the disadvantages of the HTTP mentioned above. To understand HTTPs, we will first need to understand how encryption works.

Encryption algorithms are of two types:

  • Symmetric key encryption : In this scheme, only one key is used to encrypt and decrypt information. The sender and receiver both must have access to the key to process the information.

How HTTPS works – Explained in layman terms

Symmetric key encryption
  • Asymmetric Key encryption : In this algorithm, a pair of keys is generated. Both the keys are mathematically linked. One of the keys is called the private key and the other key is the public key. Information can be encrypted using the private key and decrypted through the public key. The sender must share its public key with the receiver and encrypt the message using its private key.

How HTTPS works – Explained in layman terms

Asymmetric Key encryption

To ensure that no one on the network modifies the message, HTTPs uses Message Authentication Code (MAC).

  • Message Authentication Code: An extra piece of information known as MAC is sent along with the message to ensure message authentication. The sender uses Symmetric-key and the message to generate the MAC. Once the receiver receives the message, it will use the same symmetric-key & extracted message to generate a MAC. Further, the receiver will compare the MAC sent by the sender and the one it generated. If there is a mismatch, then it means the message got tampered mid-way. Following diagram illustrates the process of generating & verifying MAC.

How HTTPS works – Explained in layman terms

Message Authentication Code

As discussed before, the browser also needs to validate the identity of the website. In the internet world, identification means that the site client is visiting is indeed the one it thinks it is. HTTPs uses SSL certificates for identification. These SSL certificates are issued by Certificate Authorities or CAs and have validity. Let’s see who is a Certificate Authority & how it works.

  • Certificate Authority: These are third party organizations who issue certificates to different websites. They confirm the identity of the certificate owner & provide proof that a certificate is valid. All https websites have certificates. You can click the lock icon in the address bar to view the CA who has issued the certificate. Let’s see for medium.com who is the Certificate Authority.

How HTTPS works – Explained in layman terms

Certificate Authority for medium.com

It can be seen from above that connection to medium.com is secure. DigiCert is the certificate authority who has provided certificates to this website. You can find information about medium.com and also the Issuer (DigiCert) in the above image.

Conclusion

You have learnt about the working of HTTP, disadvantages of HTTP and basic building blocks of HTTPs.

In the next article, we will dive deep & see how HTTPs leverages these blocks to make the client-server communication secure.

References


以上就是本文的全部内容,希望本文的内容对大家的学习或者工作能带来一定的帮助,也希望大家多多支持 码农网

查看所有标签

猜你喜欢:

本站部分资源来源于网络,本站转载出于传递更多信息之目的,版权归原作者或者来源机构所有,如转载稿涉及版权问题,请联系我们

The Sovereign Individual

The Sovereign Individual

James Dale Davidson、William Rees-Mogg / Free Press / 1999-08-26 / USD 16.00

Two renowned investment advisors and authors of the bestseller The Great Reckoning bring to light both currents of disaster and the potential for prosperity and renewal in the face of radical changes ......一起来看看 《The Sovereign Individual》 这本书的介绍吧!

JSON 在线解析
JSON 在线解析

在线 JSON 格式化工具

RGB转16进制工具
RGB转16进制工具

RGB HEX 互转工具

URL 编码/解码
URL 编码/解码

URL 编码/解码