加载中

These days we see most of the sites using the HTTPS protocol for serving the webpages.More commonly we can see the HTTPS protocol on the sites which contains confidential information such as the websites of the banks.

If we go to google and check the address in the address bar we will see something as the following address

HTTPS protocol

As we can see above  “https” is highlighted in green and lock symbol is displayed before it to indicate that the web page is being requested over the https protocol.

HTTPS is a version of the HTTP protocol used for securely transmitting the data between the browser and server.

The communication between the browser and server happens over the HTTP protocol.Client submits information to the server which is sent in an unencrypted form over the network when we use the HTTP protocol.

最近我们看到很多站点使用 HTTPS 协议提供网页服务。通常情况下我们都是在一些包含机密信息的站点像银行看到 HTTPS 协议。

如果你访问 google,查看一下地址栏,你会看到如下信息

HTTPS protocol

我们可以看到“https" 是绿色高亮显示,并且前面有一个锁标,表明网页请求是通过 https 协议。

HTTPS 是 HTTP 协议的一个版本,在浏览器和服务器之间提供安全的数据传输。 

浏览器和服务器是通过 http 协议进行通信,在使用 HTTP 协议时,客户端向服务端提交表单数据时使用的是非加密方式。

So if some intruder has access to the physical network through which the browser and the server are communicating then he will be able to access the information which is being transmitted between the web browser and the web server

HTTPS
HTTP is fine in many scenarios in which we don’t need much security to encrypt the data.But for applications such as the banking applications which sends data such as the credit card details and other confidential information this may be a security threat.If there is an intruder watching over the communications channel he may easily get access of the confidential information provided by the end user.

所以当浏览器和服务器通信的物理网络被侵入时,入侵者会得到网页浏览器和服务器之间传输的信息。

HTTPS
HTTP 的应用场景是我们不需要使用高安全级别的方法加密数据。但银行这样的应用会发送像信用卡详细信息类的敏感数据,这会产生安全威胁。如果入侵者监视通信信道,他可以轻易获取到底层用户的敏感数据。


HTTPS ensures secure communication

To prevent such a security threat HTTPS is used.HTTPS is a protocol for securing the data which is transmitted between the web browser and the web server.

HTTP is HTTP protocol+SSL protocol.SSL is a protocol which provides safe communication over network by encrypting the information. It uses asymmetric cryptography which means that the public key is distributed freely while the private key is available only to the recipient of the message.

HTTPS protocol provides two advantages over the normal HTTP protocol:

  • It ensures that the user is communicating with the correct website ,the one he intends to communicate and not some intruder.

  • It ensures that the contents of the communication between the web browser and the web server are encrypted and hence are not accessible to the intruder.

So in HTTPS ,SSL takes care of securing the data being transmitted between the client and the web server.

HTTPS 保证安全可靠通信

为了避免这样的安全威胁,HTTPS 应运而生。HTTPS 是一个确保数据在 web 浏览器与 web 服务器之间传输安全的协议。

HTTPS 是由 HTTP 协议+SSL 协议构成。SSL 协议通过对信息进行加密,为网络通信提供安全保障。它运用了非对称密钥机制,这种机制是将公钥自由对外分发,而私钥只有信息接收者才有。

HTTPS 对比标准的HTTP协议的两大优势:

  • 它确保了用户访问的是正确的网站,这个网站是他原本打算访问的而不是一些假冒网站。

  • 它确保了web浏览器与web服务器之间通信的内容是加密的,因此入侵者不能得到原始的通信内容。

所以在 HTTPS 中,SSL 起到了确保了数据在客户端和 web 服务端传输安全。

HTTPS Process

To understand how the HTTPS protocol works we should understand how the encryption and decryption process works.
Encryption means we transform the text into some other form so that it is non readable by others.
Decryption means that we transform the encrypted text back to the original form.

Encryption and decryption process may also use keys to encrypt and decrypt the information.So if some information is encrypted using a key then it can be decrypted using the same key.This is called Symetric key as the same key is used for both encryption and decryption.

If we use one key to encrypt the string and a different key to decrypt the string then this key is called asymmetric key.The key which we use for encrypting the string is called public key while the key  which we use for decrypting the string is called the private key.

ENCRYPTION IN HTTPS

HTTPS 工作流程

为了弄清 HTPPS 协议是怎么工作的,我们首先应该明白加密、解密处理过程是怎么工作的。

加密就是把文本内容转换成其他某种格式,这样他人就无法解析原始内容。

解密就是将之前我们转换的密文再转换回原始内容。

加密和解密过程也可以用密钥去加密和解密信息。因此,如果信息是用某个密钥加密的,那么使用同一个密钥就能解密。这种方式称为对称密钥机制,因为使用的是同一个密钥进行加密和解密。

假如我们用一个密钥加密字符串,另一个密钥来解密字符串,我们就把这个密钥称为非对称密钥。我们把用来加密字符串的密钥称为公钥,而用来解密字符串的密钥称为私钥。

ENCRYPTION IN HTTPS

So now we understand that HTTPS is used to securely transmit the information between the web server and web browser.There is a well defined process which happens while transmitting the information using the HTTPS protocol.

Following process happens when the browser requests a page using the HTTPS protocol

1.Browser makes a https request to the server ,server listens on the port 443 which is the port which web servers uses to listen for the requests made using the HTTPS protocol

2.Once the connection between the web browser and the web server succeeds the SSL handshake process happens.

那么现在我们明白了 HTTPS 是用来安全传输 web 服务端与 web 浏览器之间的信息。这就是一个非常好的处理在传输信息的时候使用 HTTPS 协议。

当浏览器用 HTTPS 协议请求一个页面时,下面的过程也会发生:

1.浏览器向 server 发出 https 请求,server 监听 443 端口,这个端口是 web server 用来监听使用了 HTTPS 协议的请求。

2.一旦 web 浏览器与 web 服务器之间成功建立连接,SSL 握手流程就开始了。

In the handshake process brwoser and server agree on things such as which encryption algorithm to use for encrypting the data.So handshake process is agreement between the web browser and web server about how to encrypt the data.Following happens in the handshake process:

  • Browser sends a hello message to the server with some details about itself to the web server such as the SSL version it supports.

  • Server responds with a similar server hello message which contains details such as the SSL version which will be used for the communication.

  • Web Server sends a certificate to the browser which contains the public key which is used to encrypt the data.Certificate also contains other details such as the issuer of the certificate,validity of the certificate and the server identity.So the browser is ensured that the server is the one it intended to connect.

  • Browser verifies the server certificate and sends a certificate verify message to inform the server that the certificate is verified.

  • Browser sends a “Change cipher spec command” telling the server that the data which it will send now to the server will be encrypted.

  • Server responds with a similar “Change cipher spec command” telling the browser that the data which it will now send to the browser will be encrypted

在握手流程中,浏览器和服务器会针对数据的加密算法进行协商并答成一致。过程如下:

  • 1. 浏览器向服务器发送一些自身的信息(例如其支持的SSL版本);

  • 2. 服务器响应类似信息,例如通信过程中将要使用的SSL版本;

  • 3. 服务器会向浏览器发送证书,证书中包含了加密数据的公钥,发布者信息,有效期以及服务端唯一标识;

  • 4. 浏览器核实该证书,并发送信息通知服务器证书已验证完成;

  • 5. 浏览器向服务器发送“Change cipher spec”指令:浏览器将对数据进行加密;

  • 6. 服务器向浏览器发送“Change cipher spec”指令,服务端将要对待发送的数据进行加密。


If we click the lock symbol in chrome we can see the digital certificate sent by the server.

Digital Certificate HTTPS

 

3.Browser generates a symmetric key and encrypts it using the public key it got from the server in the certificate.Browser sends this encrypted symmetric key to the server.This symmetric key is used for encryption and decryption for the entire session.

As we know that digital certificate is used to provide the public key.There are two important terms to understand in relation to the digital certificates .

当我们单击chrome中小锁标志,我们就可以看到服务端发送过来的数字证书。

Digital Certificate HTTPS

3. 浏览器产生对称的密钥并通过服务器公钥将其加密,随后将加密后的密钥发送到服务器。这个对称的密钥用于在整个会话中进行加密和解密。

我们知道数字证书是用来提供公钥的。有两个关键的术语用来理解数字证书。

X.509 is a standard used to define the format of the digital certificate such as what information the digital certificate will contain.X.509 certificates includes some of the following information:

  • Version   Specifies the X.509 version

  • Serial number   The unique number assigned to the certificate for distinguishing the certificate

  • Issuer name  This is usually Certification Authority

  • Public key  The public key of the certificate.

Certification authority or CA is an entity which issues digital certificates.We need to get the digital certificate from the CA.Digital Certificates are signed by the CA which ensures the validity of the certificate.

X.509 是一个定义数字证书格式的标准,它规定了证书中需要包含哪些信息,例如下面:

  • 版本 指定 X.509 的版本

  • 序列号 唯一的一串数字用以区分证书

  • 证书发布者名称 CA

  • 公钥

CA(Certification authority表示发布该证书的机构。只有从发布者那里才能获得证书。证书中通常会有发布者的签名用以保证有效性。

返回顶部
顶部