##Https encryption
Introduction
Http directly passes through plain text in Messages are passed between the browser and the server, and the communication content can easily be intercepted and captured. Https uses a combination of symmetric encryption and asymmetric encryption to communicate. Https is not a new protocol at the application layer, but the Http communication interface uses SSL and TLS to strengthen the encryption and authentication mechanism.Encryption method
Symmetric encryption: Encryption and decryption use the same key. Asymmetric encryption: Keys appear in pairs, divided into public keys and private keys. Public key encryption requires private key decryption, and private key encryption requires public key decryption.The difference between the two
Symmetric encryption is fast, while asymmetric encryption is slow. Symmetric encryption requires exposing the key, which is no different from plain text transmission. Asymmetric encryption exposes the public key for client encryption, and the server uses the private key to decrypt.Selection of Https encryption
Disadvantages of symmetric encryptionSymmetric encryption is fast and suitable for Https encryption algorithm, but the password is transmitted between the server and the browser. The key process was monitored and was transmitted in clear text. Disadvantages of asymmetric encryptionThe server only exposes the public key. The browser uses the public key to asymmetrically encrypt the message, and the server uses the private key to decrypt the message. But when the server replies to the browser, it can only use the private key to encrypt, and the browser can only use the public key to decrypt. However: the public key is known to everyone, and everyone can read the message replied by the server to decrypt it, so it cannot solve the problem of the server sending the message to the browser.Https encryption
Combination of symmetric encryption and asymmetric encryptionThe browser uses the HTTPS URL to access the server and establish an SSL link. The server receives the SSL link and sends the asymmetrically encrypted public key A back to the browserThe browser generates a random number as the symmetric encryption key BBrowser Use public key A to encrypt the key B you generated to obtain key CThe browser sends key C to the server. The server uses private key D to decrypt the received key C and obtains the symmetric encryption key B. Key B can be used as a symmetric encryption key to communicate between the browser and the server. SummaryIn this way, the browser and the server share a symmetric encryption key B, and the important thing is that it will not be intercepted. Asymmetric encryption is only performed once when transmitting key B, and then symmetric encryption is used to transmit data.The above is the detailed content of What is https encryption method?. For more information, please follow other related articles on the PHP Chinese website!