HTTP vs HTTPS: Your Guide to Safe Online Surfing

Zain ul abbdin
6 min readJan 4, 2024

--

Unlocking the secrets behind online security, this article delves into the world of HTTP, HTTPS, and encryption. From shielding data through encryption methods to understanding the roles of SSL/TLS certificates, join this exploration into the vital elements safeguarding our digital interactions. Discover how these technologies fortify our online experiences, ensuring confidentiality and integrity in every click.

What is Encryption?

Encryption serves as the guardian of our online interactions, ensuring that sensitive information remains private and secure. At its core, encryption involves scrambling data into an unreadable format using cryptographic algorithms. Only authorized parties possess the one-of-a-kind key necessary to decipher this encoded data.

What is cryptography?

Cryptography is the practice and study of secure communication techniques that allow for the transformation of information in order to make it secure and immune to unauthorized access or modification. It’s a way of encoding information in such a manner that it can only be decoded or read by someone who has the proper key or knowledge.

public/private-key cryptography:

  • The public key is used for encryption
  • The secret private key is required for decryption.

Symmetric vs Asymmetric Encryption

symmetric encryption :

symmetric encryption uses a single key for both encryption and decryption. It’s like having the same key to lock and unlock a box.

Asymmetric encryption:

Asymmetric encryption uses a pair of keys — a public key and a private key — for encryption and decryption. It’s like having a lock with two different keys: one to lock and another to unlock.

What is HTTP and HTTPS?

What is protocol?

A protocol is a set of rules or guidelines that determine how data is transmitted and received over a network. It defines the format, timing, sequencing, and error checking used during communication between devices. Protocols ensure that different systems can communicate effectively by providing a standardized way for them to exchange information. Examples of protocols include HTTP (Hypertext Transfer Protocol) used for web communication, TCP/IP (Transmission Control Protocol/Internet Protocol) used for internet communication.

What is TCP?

TCP, or Transmission Control Protocol, is a fundamental communication protocol within the Internet Protocol suite. It operates at the transport layer and works in conjunction with the Internet Protocol (IP) to facilitate reliable and ordered data transmission between devices across networks.

TCP Handshake:

In networking, the TCP handshake is a process where two devices (like a client and a server) establish a connection before data transfer. It involves a series of steps to ensure synchronization and agreement:

  • SYN (Synchronize): The client sends a SYN packet to the server to initiate a connection.
  • SYN-ACK (Synchronize-Acknowledge): The server responds with a SYN-ACK packet, acknowledging the client’s request and synchronizing its sequence number.
  • ACK (Acknowledge): Finally, the client sends an ACK packet back to the server, confirming receipt and finalizing the connection setup.

Data Flow in HTTP

In HTTP, when you request or send information from your browser to a web server, the data travels as plain text. This means that anyone with the right tools and access to the network can potentially intercept and view this information, including sensitive details like login credentials or personal data.

TCP Handshake:

TCP (Transmission Control Protocol) is a foundational protocol that manages the reliable transmission of data between devices. The TCP handshake is the initial process of establishing a connection before data transfer. It involves a three-way process:

SYN (Synchronize):

  • The client sends a SYN packet to the server to initiate a connection.
  • It includes a random sequence number in its SYN packet.

SYN-ACK (Synchronize-Acknowledge):

  • The server responds with a SYN-ACK packet.
  • It acknowledges the client’s SYN packet and includes its own random sequence number.

ACK (Acknowledge):

  • The client sends an ACK packet back to the server, confirming receipt of the server’s SYN-ACK packet.
  • This finalizes the TCP handshake, and the connection is established for data transfer.

Role of SSL/TLS Certificates

SSL/TLS certificates play a pivotal role in making HTTPS possible. These certificates act as digital passports that verify the authenticity of a website’s identity and enable secure connections. They come from Certificate Authorities (CAs) and contain details about the website, the organization to which it belongs, and the cryptographic keys required for encryption.

Data Flow in HTTPS

Client Request: The client (e.g., a web browser) initiates a request to access a secure website by typing “https://” in the URL or clicking on a secure link.

Server Response: The server receives the request and responds by initiating an HTTPS connection, indicating its willingness to establish a secure connection.

SSL/TLS Handshake:

  • Client Hello: The client sends a “Client Hello” message, initiating the SSL/TLS handshake. It includes details like supported encryption methods.
  • Server Hello: The server responds with a “Server Hello,” acknowledging the client’s request and providing its SSL/TLS certificate.
  • Certificate Exchange: The server sends its digital certificate containing its public key and other information needed for the encryption process.
  • Client Key Exchange: The client generates a session key and encrypts it using the server’s public key before sending it back to the server.
  • Session Key Creation: Both the client and server use the exchanged keys to create a session key, which will be used for symmetric encryption during the secure connection.
  • Encryption Activation: Once the session key is established, symmetric encryption is employed for data transfer.
  • Data Transfer: The client and server now communicate using the established secure connection, ensuring that the data exchanged between them is encrypted using symmetric encryption, making it secure against eavesdropping.

Role of Components:

  • TCP Handshake: TCP ensures a reliable connection between the client and the server before SSL/TLS handshake initiation, managing data delivery in a structured manner.
  • SSL/TLS (Secure Sockets Layer/Transport Layer Security): SSL/TLS protocols ensure data encryption, integrity, and authentication during communication. They establish secure connections between the client and server, enabling encrypted data transfer.
  • Asymmetric Encryption: During the SSL/TLS handshake, asymmetric encryption is used. The server’s digital certificate contains a public key that encrypts the session key generated by the client, ensuring secure exchange without revealing the session key.
  • Symmetric Encryption: Once the session key is established through asymmetric encryption, symmetric encryption is employed for actual data transfer. It’s faster and uses the same key for both encryption and decryption, ensuring secure communication between the client and server.
  • Public Key: The public key is part of the server’s digital certificate. It’s used to encrypt the session key during the SSL/TLS handshake. The corresponding private key, held securely by the server, is used to decrypt the session key.

HTTP(Hypertext Transfer Protocol) and HTTPS (Hypertext Transfer Protocol Secure) are protocols used for transmitting data over the internet. HTTP is the standard protocol for web communication but is unencrypted, leaving data vulnerable to interception.

HTTPS, on the other hand, adds a layer of security through encryption. Encryption scrambles data into a code that can only be deciphered with the correct decryption key, safeguarding sensitive information from prying eyes.

SSL (Secure Sockets Layer) and TLS (Transport Layer Security), its successor, facilitate this encryption. SSL and TLS protocols establish secure connections between web servers and browsers, ensuring data integrity, authentication, and confidentiality. They employ cryptographic techniques to create a secure tunnel for transmitting information, thereby enhancing online security and privacy.

--

--