SSL and first step of handshaking

When I connect to a secure sever that has is equipped with SSL certificate.

Logically, the first step is the handshake to discuss the cipher suites etc.

However, the very first time my web browser does a DNS request and comes up with the location of the site, and my browser connects to the website even before starting the handshake, is this step secure (encrypted by the public key of the websites web server by getting its public key from the built in keys in the browser) or no?

Update: What I mean here, what happens the very first thing when I open the browser and type https://randomness.org the very first time my broswer (computer) and the server come in to contact. Is this connection secure?

• Do you mean is it secure for the browser to, without any prior knowledge, to ask the server for its public key? Yes / no. This relies 100% on the root trust chain and that certificate authorities are well behaved. Past this point your only benefit is certificate pinning, which can lock the public key such that it cannot change, even if certificate authorities want to sign other certificates. Your browser will obey the pinning over CAs, but your friend who hasn't been to the site will not have this benefit as pinning is local and not shared with https: links. – cypherfox Mar 12 '18 at 14:34
• In the same breath, if the server is compromised at any point in time, then the adversary can set the public key pinning to something the real site doesn't control, leading to a denial of service or ransom against the service. This only affects users whose browsers locked in the pinning. – cypherfox Mar 12 '18 at 14:35