what if the hacker provided the public key for https connection?

https://monyet.cc/post/4974494

what if the hacker provided the public key for https connection? - monyet.cc

So this video explains how https works. What I don’t get is what if a hacker in the middle pretended to be the server and provided me with the box and the public key. wouldn’t he be able to decrypt the message with his private key? I’m not a tech expert, but just curious and trying to learn.

It is possible and it has been done.

You need to get your “hacker” key signed/certified by an official CA. Which is not that difficult with some of them because they are doing it for money.

You don’t really ‘need to’ in a world where a good proportion of people will happily click ‘continue anyway’ when they get any sort of certificate error

people will happily click ‘continue anyway’

Not possible without a certificate. There will be no TLS connection, only an error message. No ‘click continue’.

It is trivial for an attacker to make self-signed TLS certs, and you can absolutely just click “continue” on sites that use them when you get a warning from the browser
What browser is that?
Firefox, Chrome, Edge, will all warn you about self-signed certs or cert mismatches but allow you to continue. You’re completely correct that SSL/TLS needs a certificate, but it doesn’t need to be CA issued or in any way legitimate for the encrypted tunnel to be established