Private archive copy · Unofficial site · Content copyright belongs to Runoob Tutorial and the original authors · View Original

HTTPS Protocol

HTTPS Protocol

HTTPS (HyperText Transfer Protocol Secure) is the secure version of HTTP. It adds a TLS/SSL encryption layer between HTTP and the transport layer to protect the security and integrity of data transmission.

HTTPS is widely used to protect the transmission of sensitive information (such as login credentials and payment information).


How HTTPS Works

The core of HTTPS is adding a TLS/SSL encryption layer on top of HTTP, protecting data transmission through encryption and identity verification mechanisms.

1. HTTPS Connection Establishment

  1. ClientHello: The client sends a list of supported encryption algorithms.
  2. ServerHello: The server selects an encryption algorithm and sends the server certificate.
  3. Certificate Verification: The client verifies the validity of the server certificate.
  4. Key Exchange: The client generates a pre-master secret, encrypts it with the server's public key, and sends it.
  5. Session Key: Both parties generate a session key from the pre-master secret to encrypt subsequent communications.

2. HTTP Communication

After the encrypted channel is established, the client and server communicate over HTTP via HTTPS:


Key Features of HTTPS

  1. Encrypted Communication:

  2. Uses symmetric encryption (such as AES) to encrypt data.
  3. Uses asymmetric encryption (such as RSA) to exchange keys.
  4. - Uses symmetric encryption (such as AES) to encrypt data. - Uses asymmetric encryption (such as RSA) to exchange keys.
    1. Authentication:

    2. Verifies the server's identity through the server certificate.
    3. Optionally verifies the client's identity through a client certificate.
    4. - Verifies the server's identity through the server certificate. - Optionally verifies the client's identity through a client certificate.
      1. Data Integrity:

      2. Uses hash algorithms (such as SHA) to ensure data has not been tampered with.
      3. - Uses hash algorithms (such as SHA) to ensure data has not been tampered with.
        1. Compatibility:

        2. Fully compatible with HTTP, supporting the same request methods and response formats.
        3. - Fully compatible with HTTP, supporting the same request methods and response formats.

          Application Scenarios of HTTPS

          HTTPS is widely used in the following scenarios:


          Security of HTTPS

          HTTPS improves security through the following mechanisms:

          1. Encrypted transfer: Prevent data from being eavesdropped.
          2. Authentication: Prevent servers from being impersonated.
          3. Data Integrity: Prevent data from being tampered with.

          HTTPS Certificates

          The security of HTTPS relies on server certificates, which are issued by trusted certificate authorities (CA) and contain the following information:


          Deployment of HTTPS

          Deploying HTTPS requires the following steps:

          1. Obtain a Certificate: Apply for a server certificate from a CA.
          2. Configure the Server: Install the certificate on the server and enable HTTPS.
          3. Redirect HTTP to HTTPS: Ensure all traffic is transmitted over HTTPS.

          Alternatives to HTTPS

          In some scenarios, the following alternatives can be used: