This article will take you through the problems of HTTP and introduce how HTTPS ensures security. It has certain reference value. Friends in need can refer to it. I hope it will be helpful to everyone.
Problems with HTTP
1, Eavesdropping risk: Communication use Plain text (not encrypted), the content may be eavesdropped (a third party may learn the communication content)
2, Risk of impersonation: The identity of the communicating party is not verified, so there is a possibility of encountering disguise
3, Tampering risk: The integrity of the message cannot be proven, so it may have been tampered
HTTPS
You can see HTTPS websites, and a lock mark will appear in the address bar of the browser.
HTTPS is not a new protocol for the application layer. Usually HTTP communicates directly with TCP, while HTTPS first communicates with the security layer (SSL/TLS), and then the security layer communicates with the TCP layer.
The SSL/TLS protocol was born to solve the problems of HTTP mentioned above. Let’s take a look at how it is solved. :
1. All information is encrypted and transmitted, and third parties cannot eavesdrop.
2. Equipped with identity verification to prevent identity impersonation
3. Has a verification mechanism , once tampered with, both communicating parties will immediately discover it
Encryption
##Symmetric encryption
Encryption The method of using the same secret key for decryption is called shared key encryption, also called symmetric key encryption.- The browser sends to the server
client_random
and a series of encryption methods
- The server sends it to the browser
server_random
and encryption method
##The existing browser and server have three identical credentials:
, server_random
and encryption methodUse the encryption method to mix the two random numbers
client_random
and server_random
to generate a secret key. This key is the password for communication between the browser and the server. Existing problems: The third party can obtain
, server_random
and the encryption method in the middle. Since this encryption method can be decrypted at the same time, the middleman can successfully decipher the password. By decrypting and obtaining the data, it is easy to crack this encryption method.
- The server sends the encryption method and public key to the browser
- The browser then encrypts the data and transmits it to the server through the public key, and the server receives the data Decrypt using private key. When the server sends data to the browser, it uses the private key to encrypt it. The browser receives the data sent from the server and uses the public key to decrypt it.
- The efficiency of asymmetric encryption is too low
- , which will seriously affect the speed of encryption and decryption, and then affect the user's ability to open the page speed.
- . The server's data can only be encrypted with the private key (because if it uses the public key, the browser cannot It cannot be decrypted). Once the middleman gets the public key, he can decrypt the data sent from the server, and it is cracked again.
The data transmission phase still uses symmetric encryption, but we use non-symmetric encryption keys. Symmetrically encrypted transmission.
- The server receives it and returns server_random, encryption method and public key.
- The browser receives it, then generates another random number pre_master, encrypts it with the public key, and transmits it to the server. (Key operation!)
- The server uses the private key to decrypt the encrypted pre_master.
So far, the server and browser have the same client_random
, server_random
and pre_master
, and then the server and browser The server will use these three sets of random numbers to generate a symmetric secret key. With the symmetric secret key, both parties can use symmetric encryption to transmit data.
CA (digital certificate)
uses a symmetric and asymmetric hybrid method to achieve encrypted transmission of data. But there is still a problem, the server may be impersonated by hackers. In this way, the browser accesses the hacker's server, and the hacker can implement the public key and private key on his own server. However, the browser does not fully know that the hacker's site is being visited.
The server needs to prove its identity and needs to use a certificate issued by an authoritative organization. This authoritative organization is the CA (Certificate Authority). The issued certificate is called a digital certificate (Digital Certificate).
For the browser, the digital certificate has two functions:
Prove the identity of the server to the browser through the digital certificate
-
The digital certificate contains the server public key
Let’s take a look at the HTTPS request process containing the digital certificate
Compared to the HTTPS request process without digital certificates, the following two main changes have been made
The server does not directly return the public key to the browser, but returns the number Certificate, and the public key is included in the digital certificate;
There is an additional certificate verification operation on the browser side. After the certificate is verified, the subsequent process continues.
Reference
How to explain asymmetry in easy-to-understand terms Encryption?
(1.6w words) The soul of the browser Ask, how many can you pick up?
Recommended tutorial: Web server security
The above is the detailed content of How does HTTPS ensure security? (detailed explanation). For more information, please follow other related articles on the PHP Chinese website!

Nginx是一个高性能的Web服务器软件,同时也是一款强大的反向代理服务器和负载均衡器。随着互联网的迅速发展,越来越多的网站开始采用SSL协议保护敏感用户数据,而Nginx也提供了强大的SSL支持,使得Web服务器的安全性能更进一步。本文将介绍如何配置Nginx以支持SSL协议,并保护Web服务器的安全性能。什么是SSL协议?SSL(SecureSocke

在当今互联网时代,安全通信已经成为了不可或缺的一部分。尤其是在HTTPS通信中,如何保障其安全性尤为重要。而Nginx作为流行的Web服务器和反向代理服务器,其防火墙也可以在保障HTTPS安全通信中发挥重要作用。本文将就Nginx防火墙从以下几个方面进行讨论。TLS/SSL加密HTTPS通信的安全保障主要是基于TLS/SSL加密技术,其能够防止数据在传输过程

单向验证与双向验证的区别:单向验证:指客户端验证服务器端证书,服务器并不需要验证客户端证书。双向验证:指客户端验证服务器端证书,而服务器也需要通过ca的公钥证书来验证客户端证书。详细的握手过程:单向验证浏览器发送一个连接请求给安全服务器。1、服务器将自己的证书,以及同证书相关的信息发送给客户浏览器。2、客户浏览器检查服务器送过来的证书是否是由自己信赖的ca中心所签发的。如果是,就继续执行协议;如果不是,客户浏览器就给客户一个警告消息:警告客户这个证书不是可以信赖的询问客户是否需要继续。3、接着客

下载证书在证书控制台下载nginx版本证书。下载到本地的压缩文件包解压后包含:.pem文件:证书文件.key文件:证书的私钥文件(申请证书时如果没有选择自动创建csr,则没有该文件)配置nginx1、在nginx的安装目录下创建cert目录,并且将下载的全部文件拷贝到cert目录中,如果申请证书时是自己创建的csr文件,请将对应的私钥文件放到cert目录下。2、打开nginx安装目录下conf目录中的nginx.conf文件#usernobody;worker_processes1;#error

随着科技的发展,网络通信已经成为了现代社会信息传输的重要工具之一。但同时,网络上的信息传输面临着被恶意攻击和窃取的风险,因此安全性显得尤为重要。基于此,HTTPS协议就应运而生。它是在HTTP协议上加入SSL/TLS加密的方式来保证网络传输安全性的一种协议。Java作为一门广泛应用于网络开发的语言,自然也提供了丰富的API来支持HTTPS协议。本文将

效果可以看如下:但是如果我们现在使用http来访问的话,访问不了。如下图所示:因此我现在首先要做的是使用nginx配置下,当用户在浏览器下输入http请求的时候使用nginx重定向到https下即可。因此我们现在需要做一个简单的nginx重定向功能。因此在我们的nginx中需要加如下重定向配置:server{listenxxx.abc.com;server_namexxx.abc.com;rewrite^/(.*)$https://$host$1permanent;}因此nginx主要的配置代码

假如我现在node基本架构如下:|----项目||---static#存放html文件|||---index.html#index.html||---node_modules#依赖包||---app.js#node入口文件||---package.json||---.babelrc#转换es6文件index.html文件代码如下:nginx配置https欢迎使用https来访问页面app.js代码如下:constkoa=require('koa');constfs

Golang是一种高效的编程语言,经常被用于创建网络应用程序。在网络应用程序中,经常需要对URL地址进行验证,以确保它们符合我们的目标。在这篇文章中,我们将会介绍如何在Golang中使用正则表达式来验证URL地址是否为HTTPS协议。首先,我们需要了解HTTPS协议的URL格式。HTTPS协议的URL从HTTP协议URL中继承了一部分,但是它有一些独特的特征


Hot AI Tools

Undresser.AI Undress
AI-powered app for creating realistic nude photos

AI Clothes Remover
Online AI tool for removing clothes from photos.

Undress AI Tool
Undress images for free

Clothoff.io
AI clothes remover

AI Hentai Generator
Generate AI Hentai for free.

Hot Article

Hot Tools

SublimeText3 Mac version
God-level code editing software (SublimeText3)

SAP NetWeaver Server Adapter for Eclipse
Integrate Eclipse with SAP NetWeaver application server.

MinGW - Minimalist GNU for Windows
This project is in the process of being migrated to osdn.net/projects/mingw, you can continue to follow us there. MinGW: A native Windows port of the GNU Compiler Collection (GCC), freely distributable import libraries and header files for building native Windows applications; includes extensions to the MSVC runtime to support C99 functionality. All MinGW software can run on 64-bit Windows platforms.

Dreamweaver CS6
Visual web development tools

WebStorm Mac version
Useful JavaScript development tools