Brief description of HTTPS protocol

Application layer protocol: responsible for data communication between applications.
The https protocol is the encrypted http protocol, the default port of the http protocol is 80, and the default port of https is 443.

How to encrypt the HTTP protocol

Realized by SSL encryption, the encryption method is mainlyHas a symmetric encryption algorithmas well asAsymmetric encryption algorithmTwo kinds.
Because data is easy to be hijacked when it is being transmitted, there is a great security risk, so it needs to be encrypted during transmission.

Symmetric encryption algorithm

Symmetric encryption means that how to encrypt, just how to decrypt. The encryption method is the same as the decryption method.

  • Advantages: The efficiency of encryption and decryption is higher. Because the encryption and decryption methods are the same, the decryption speed is faster.
  • Disadvantages: There will be no problems in a short period of time. After a long time, the encryption method will be derived, and the encrypted content is easy to be cracked.
  • Solution: A new symmetric encryption algorithm can be dynamically negotiated before communication each time.

Asymmetric encryption algorithm

The encryption and decryption methods are different. The server generates a public key and a private key. The public key and the private key are a key pair, the public key is the public part of the key pair, and the private key is the undisclosed part. The public key is often used to encrypt the session and verify the digital signature. The encrypted session can be translated and decrypted by the private key.

  • Advantages: high security, not easy to be cracked.
  • Disadvantages: The decryption speed is relatively slow, and the transmission efficiency is relatively low.
  • Solution: Combine asymmetric encryption algorithm with symmetric encryption algorithm. The client's symmetric encryption algorithm process is protected by asymmetric encryption, and then the negotiated symmetric encryption algorithm is used for encryption and decryption.

The problem of combining symmetric encryption and asymmetric encryption: public key but don't hijack, there will be data loss.
Insert picture description here
Solution: Sign the certificate and transmit the public key information.
Certificate content: public key information, authority information, validity time, company information...

SSL encryption process

  • When TCP is communicating, the link is established successfully.
  • The server will first send the certificate to the client, and the client will perform identity authentication based on the information in the certificate.
  • If the identity authentication fails, you can disconnect the link directly, or you can set whether to trust this website.
  • If the identity authentication is passed, use the public key in the certificate to encrypt the negotiation process of the symmetric encryption symmetric algorithm.
  • Finally, the successfully negotiated symmetric encryption algorithm is used to encrypt the communication.

Guess you like

Origin blog.csdn.net/qq_42708024/article/details/106272338