Sitemap
Maciej Najbar

Maciej Najbar

Is HTTPS secure?

The best explanation I can give you.

3 min readAug 26, 2026

--

Press enter or click to view image in full size

During interviews I ask about HTTP protocol and the difference between HTTP and HTTPS. Typical answer is “it’s a secure HTTP”. Ok, but how? Can you explain?

If someone knows how it works, I will get the answer that there is a TLS layer that encrypts messages and that there is a certificate with server’s public key and it works.

I love this question about HTTPS because it allows me to check if candidate knows the difference between symmetric and asymmetric encryption, verifying signatures, TLS layer and how it’s all connected with HTTP. If you learn how it works by heart, you can only believe it works. So let me explain on a real-life example, to help you understand.

HTTP

Imagine you and I sit in a church. We mustn’t talk in church, but we can text. You poke me (handshake). I pull up my phone, open text editor and hand you this phone. You write your question and I write you back the answer. We pass this phone to each other having great conversation.

Man-In-The-Middle Attack

Imagine that someone sits between us. Now we are forced to pass this phone through that person. This man now can read our conversation while passing phone back and forth.

HTTPS — first iteration

You found out that the man between us is reading our conversation. Thankfully you came up with simple encryption. You figured that we use phone (TLS) for message transfer. When I pass you the phone for the first time the text editor is empty. You write your question and you lock the phone before passing it back to me. Everyone knows how to lock the phone with a power button (public key). Only I know how to unlock it with a pin and read the message (private key).

Get Maciej Najbar’s stories in your inbox

Join Medium for free to get updates from this writer.

The problem is — you don’t know the pin (asymmetric encryption). Even though that man didn’t read your question, he will read my response.

HTTPS — second iteration

You got a clever idea. The first message you send to me will contain pin that you want me to use for the phone (symmetric encryption). When I read the message I set the pin you requested and pass you the locked phone. From now on we can text fully encrypted messages.

If you think the man surrendered, you are wrong! The attacker found out that he has exactly the same model of the phone as I have. He keeps my phone and passes his phone to you.

HTTPS — third iteration

You noticed the man smiles when you send a funny message. You have a hunch you receive the wrong phone. You decided to check the serial number with some authority (Certificate Authority). You confirm the phone you hold is actually my phone (certificate verification). It’s not. You pass back the phone and cut the conversation. You sit on my opposite site and make sure this time we have a secure conversation.

In the world of AI articles are generated and flood the Internet. This post was not written by any bot. If you find it useful, I’d be super grateful for sharing it.

I believe that using AI can only help you know things faster, but to really understand it, you must do the work yourself. Try explaining it to another person — you will quickly spot what you still do not understand.

If you find any part of this article can be improved, please leave a comment.

--

--