The obvious answer is to get your certificate signed as close to the root of a well-rooted Certificate Authority (CA) as possible. But that isnâ€™t very helpful. To answer the question, lets look at a few of the problems and tradeoffs.

Problem #1: Most CAâ€™s Wonâ€™t Sign At The Root

Most CAâ€™s wonâ€™t sign from the root. Root CAs are key to our overall trust on the web, so simply having them online is a security risk. If the roots are hacked, it can send a shockwave through our circle of trust. As such, most CAs keep their root servers offline most of the time, and only bring them online occasionally (every few months) to sign for a subordinate CA in the chain. The real signing is most often done from the subordinate.

While this is already considered a â€˜best practiceâ€™ for CAs, Microsoftâ€™s Windows Root CA Program Requirements were just updated last month to require that leaf certificates are not signed directly at the root. From section F-2:

All root certificates distributed by the Program must be maintained in an offline state â€“ that is, root certificates may not issue end-entity certificates of any kind, except as explicitly approved from Microsoft.

Unfortunately for latency, this is probably the right thing to do. So expecting a leaf certificate directly from the root is unreasonable. The best we can hope for is one level down.

Problem #2: â€œWorksâ€ is more important than â€œFastâ€

Having your site be accessible to all of your customers is usually more important than being optimally fast. If you use a CA not trusted by 1% of your customers, are you willing to lose those customers because they canâ€™t reach your site? Probably not.

To solve this, we wish that we could serve multiple certificates, and always present a certificate to the client which we know that specific will trust. (e.g. if an old Motorola Phone from 2005 needs a different CA, we could use a different certificate just for that client. But alas, SSL does not expose a user-agent as part of the handshake, so the server canâ€™t do this. Again, hiding the user agent is important from a privacy and security point of view.

Because we want to reach all of our clients, and because we donâ€™t know which client is connecting to us, we simply have to use a certificate chain which we know all clients will trust. And that leads us to either presenting a very long certificate chain, or only purchasing certificates from the oldest CAs.

I am sad that our SSL protocol gives the incumbent CAs an advantage over new ones. It is hard enough for a CA to get accepted by all the modern browsers. But how can a CA be taken seriously if it isnâ€™t supported by 5-10% of the clients out there? Or if users are left with a higher-latency SSL handshake?

Problem #3: Multi-Rooting of CAs

We like to think of the CA trust list as well-formed tree where the roots are roots, and the non-roots are not roots. But, because the clients change their trust points over time, this is not the case. What is a root to one browser is not a root to another.

As an example, we can look at the certificate chain presented by www.skis.com. Poor skis.com has a certificate chain of 5733 bytes (4 pkts, 2 RTs), with the following certificates:

skis.com: 2445 bytes

Go Daddy Secure Certification Authority 1250 bytes

Go Daddy Class 2 Certification Authority: 1279 bytes

ValiCert Class 2 Policy Validation Authority: 747 bytes

In Firefox, Chrome and IE (see note below), the 3rd certificate in that chain (Go Daddy Class 2 Certification Authority) is already considered a trusted root. The server sent certificates 3 and 4, and the client didnâ€™t even need them. Why? This is likely due to Problem #2 above. Some older clients may not consider Go Daddy a trusted root yet, and therefore, for compatibility, it is better to send all 4 certificates.

What Should Facebook Do?

Obviously I donâ€™t know exactly what Facebook should do. Theyâ€™re smart and theyâ€™ll figure it out. But FBâ€™s large certificate chain suffers the same problem as the Skis.com site: they include a cert they usually donâ€™t need in order to ensure that all users can access Facebook.

Recall that FB sends 3 certificates. The 3rd is already a trusted root in the popular browsers (DigiCert), so sending it is superfluous for most users. The DigiCert cert is signed by Entrust. I presume they send the DigiCert certificate (1094 bytes) because some older clients donâ€™t have DigiCert as a trusted root, but they do have Entrust as a trusted root. I can only speculate.

Facebook might be better served to move to a more well-rooted vendor. This may not be cheap for them.

Aside: Potential SSL Protocol Improvements

If youâ€™re interested in protocol changes, this investigation has already uncovered some potential improvements for SSL:

Exposing some sort of minimal user-agent would help servers ensure that they can select an optimal certificate chain to each customer. Or, exposing some sort of optional â€œI trust CA root list #1234â€, would allow the server to select a good certificate chain without knowing anything about the browser, other than its root list. Of course, even this small amount of information does sacrifice some amount of privacy.

The certificate chain is not compressed. It could be, and some of these certificates compress by 30-40%.

If SNI were required (sadly still not supported on Windows XP), sites could avoid lengthy lists of subject names in their certificates. Since many sites separate their desktop and mobile web apps (e.g. www.google.com vs m.google.com), this may be a way to serve better certificates to mobile vs web clients.

Who Does My Browser Trust, Anyway?

All browsers use a â€œcertificate storeâ€ which contains the list of trusted root CAs.

The certificate store can either be provided by the OS, or by the browser.

On Windows, Chrome and IE use the operating-system provided certificate store. So they have the same points of trust. However, this means that the trust list is governed by the OS vendor, not the browser. Iâ€™m not sure how often this list is updated for Windows XP, which is still used by 50% of the worldâ€™s internet users.

On Mac, Chrome and Safari use the operating system provided store.

On Linux, there is no operating system provided certificate store, so each browser maintains its own certificate store, with its own set of roots.

Firefox, on all platforms (I believe, I might be wrong on this) uses its own certificate store, independent of the operating system store.

Finally, on mobile devices, everyone has their own certificate store. Iâ€™d hate to guess at how many there are or how often they are updated.

Complicated, isnâ€™t it?

Yeah Yeah, but Where Do I Get The Best Certificate?

If you read this far, you probably realize I canâ€™t really tell you. It depends on who your target customers are, and how many obscure, older devices you need to support.

From talking to others who are far more knowledgeable on this topic than I, it seems like you might have the best luck with either Equifax or Verisign. Using the most common CAs will have the side benefit that the browser may have cached the OCSP responses for any intermediate CAs in the chain already. This is probably a small point, though.

Some of the readers of this thread pointed me at what appears to be the smallest, well-rooted certificate chain Iâ€™ve seen. https://api-secure.recaptcha.net has a certificate signed directly at the root by Equifax. The total size is 871 bytes. I donâ€™t know how or if you can get this yourself. You probably canâ€™t.

Finally, Does This Really Matter?

SSL has two forms of handshakes:

Full Handshake

Session Resumption Handshake

All of this certificate transfer, OCSP and CRL verification only applies to the Full Handshake. Further, OCSP and CRL responses are cacheable, and are persisted to disk (at least with the Windows Certificate Store they are).

So, how often do clients do a full handshake, receiving the entire certificate chain from the server? I donâ€™t have perfect numbers to cite here, and it will vary depending on how frequently your customers return to your site. But there is evidence that this is as high as 40-50% of the time. Of course, the browser bug mentioned in the prior article affects these statistics (6 concurrent connections, each doing full handshakes).

And how often do clients need to verify the full certificate chain? This appears to be substantially less, thanks to the disk caching. Our current estimates are less than 5% of SSL handshakes do OCSP checks, but weâ€™re working to gather more precise measurements.

In all honesty, there are probably more important things for your site to optimize. This is a lot of protocol gobbledygook.

Thank you to agl, wtc, jar, and others who provided great insights into this topic.

Most people know the concepts of SSL, but not the gory details. By using Facebook as a walkthrough example, Iâ€™m going to discuss how it works from the browserâ€™s viewpoint, and how it impacts latency to your site. BTW, this is not intended as a criticism of Facebook – theyâ€™re doing all the right things to make sure your data is encrypted and authenticated and fast. The failures highlighted here are failures of a system that wasnâ€™t designed for speed.

Fetching the CertificateWhen you first connect to a SSL site, the client and server use the serverâ€™s public key to exchange a secret which will be used to encrypt the session. So the first thing the client needs to do is to get the serverâ€™s public key. The public key is sent as part of the SSL Server Hello message. When we look at the Server Hello Message from Facebook, we see that it sent us a Certificate which was 4325 bytes in size. This means that before your HTTP request even gets off your computer, the server had to send 4KB of data to the client. Thatâ€™s a pretty big bundle, considering that the entire Facebook login page is only 8.8KB. Now, if a public key is generally only 1024 or 2048 bits, with elliptic curve keys being much smaller than that, how did Facebookâ€™s certificate mushroom from 256 to 4325 bytes? Clearly there is a lot of overhead. More on this later.

Trusting the CertificateOnce the browser has the serverâ€™s certificate, it needs to validate that the certificate is authentic. After all, did we really get Facebookâ€™s key? Maybe someone is trying to trick us. To deal with this, public keys are always transferred as part of a certificate, and the certificate is signed by a source, which needs to be trusted. Your operating system shipped with a list of known and trusted signers (certificate authority roots). The browser will verify that the Facebook certificate was signed by one of these known, trusted signers. There are dozens of trusted parties already known to your browser. Do you trust them all? Well, you donâ€™t really get a choice. More on this later.

But very few, if any, certificates are actually signed by these CAâ€™s. Because the Root CAâ€™s are so important to the overall system, theyâ€™re usually kept offline to minimize chances of hackery. Instead, these CAs periodically delegate authority to intermediate CAs, when then validate Facebookâ€™s certificate. The browser doesnâ€™t care who signs the certificate, as long the chain of certificates ultimately flows to a trusted root CA.

And now we can see why Facebookâ€™s Certificate is so large. Itâ€™s actually not just one Certificate – it is 3 certificates rolled into one bundle:

The browser must verify each link of the chain in order to authenticate that this is really Facebook.com.

Facebook, being as large as they are, would be well served by finding a way to reduce the size of this certificate, and by removing one level from their chain. They should talk to DigiSign about this immediately.

Verifying The Certificate With the Facebook Certificate in hand, the browser can almost verify the site is really Facebook. There is one catch – the designers of Certificates put in an emergency safety valve. What happens if someone does get a fraudulent certificate (like what happened last month with Comodo) or steal your private key? There are two mechanisms built into the browser to deal with this.

Most people are familiar with the concept of the â€œCertificate Revocation Listâ€ (CRL). Inside the certificate, the signer puts a link to where the CRL for this certificate would be found. If this certificate were ever compromised, the signer could add the serial number for this certificate to the list, and then the browser would refuse to accept the certificate. CRLs can be cached by the operating system, for a duration specified by the CA.

The second type of check is to use the Online Certificate Status Protocol (OCSP). With OCSP, instead of the browser having to download a potentially very large list (CRL), the browser simply checks this one certificate to see if it has been revoked. Of course it must do this for each certificate in the chain. Like with CRLs, these are cacheable, for durations specified in the OCSP response.

In the Facebook.com example, the DigiCert certificates specify an OCSP server. So as soon as the browser received the Server Hello message, it took a timeout with Facebook and instead issued a series of OCSP requests to verify the certificates havenâ€™t been revoked.

In my trace, this process was quick, with a 17ms RTT, and spanning 4 round-trips (DNS, TCP, OCSP Request 1, OCSP Request 2), this process took 116ms. Thatâ€™s a pretty fast case. Most users have 100+ms RTTs and would have experienced approximately a Â½ second delay. And again, this all happens before weâ€™ve transmitted a single byte of actual Facebook content. And by the way, the two OCSP responses were 417 bytes and 1100 bytes, respectively.

Oh but the CDN!All major sites today employ Content Delivery Networks to speed the site, and Facebook is no exception. For Facebook, the CDN site is â€œstatic.ak.facebook.comâ€, and it is hosted through Akamai. Unfortunately, the browser has no way of knowing that static.ak.facebook.com is related to facebook.com, and so it must repeat the exact same certificate verification process that we walked through before.

For Facebookâ€™s CDN, the Certificate is 1717 bytes, comprised of 2 certificates:

Unlike the certificate for facebook.com, these certificates specify a CRL instead of an OCSP server. By manually fetching the CRL from the Facebook certificate, I can see that the CRL is small – only 886 bytes. But I didnâ€™t see the browser fetch it in my trace. Why not? Because the CRL in this case specifies an expiration date of July 12, 2011, so my browser already had it cached. Further, my browser wonâ€™t re-check this CRL until July, 4 months from now. This is interesting, for reasons Iâ€™ll discuss later.

Oh but the Browser Bug! But for poor Facebook, there is a browser bug (present in all major browsers, including IE, FF, and Chrome) which is horribly sad. The main content from Facebook comes from www.facebook.com, but as soon as that page is fetched, it references 6 items from static.ak.facebook.com. The browser, being so smart, will open 6 parallel SSL connections to the static.ak.facebook.com domain. Unfortunately, each connection will resend the same SSL certificate (1717 bytes). That means that weâ€™ll be sending over 10KB of data to the browser for redundant certificate information.

The reason this is a bug is because, when the browser doesnâ€™t have certificate information cached for facebook.com, it should have completed the first handshake first (downloading the certificate information once), and then used the faster, SSL session resumption for each of the other 5 connections.

Putting It All Together So, for Facebook, the overall impact of SSL on the initial user is pretty large. On the first connection, weâ€™ve got:

2 round trips for the SSL handshake

4325 bytes of Certificate information

4 round trips of OCSP validation

1500 bytes of OCSP response data

Then, for the CDN connections weâ€™ve got:

2 round trips for the SSL handshake

10302 bytes of Certificate information (1717 duplicated 6 times)

The one blessing is that SSL is designed with a fast-path to re-establish connectivity. So subsequent page loads from Facebook do get to cut out most of this work, at least until tomorrow, when the browser probably forgot most of it and has to start over again.

Making it Better

OCSP & CRLs are broken In the above example, if the static.ak.facebook.com keys are ever compromised, browsers around the planet will not notice for 4 months. In my opinion, that is too long. For the OCSP checks, we cache the result for usually ~7 days. Having users exposed to broken sites for 7 days is also a long time. And when Comodo was hacked a month ago, the browser vendors elected to immediately patch every browser user on the planet rather than wait for the OCSP caches to expire in a week. Clearly the industry believes the revocation checking is broken when it is easier to patch than rely on the built-in infrastructure.

But it is worse than that. What does a browser do when if the OCSP check fails? Of course, it proceeds, usually without even letting the user know that it has done so (heck, users wouldnâ€™t know what to do about this anyway)! Adam Langley points this out in great detail, but the browsers really donâ€™t have an option. Imagine if DigiCert were down for an hour, and because of that users couldnâ€™t access Facebook? Itâ€™s far more likely that DigiCert had downtime than that the certificate has been revoked.

But why are we delaying our users so radically to do checks that weâ€™re just going to ignore the result of if they fail anyway? Having a single-point-of-failure for revocation checking makes it impossible to do anything else.

Certificates are Too Wordy I feel really sorry for Facebook with itâ€™s 4KB certificate. I wish I could say theirs was somehow larger than average. They are so diligent about keeping their site efficient and small, and then they get screwed by the Certificate. Keep in mind that their public key is only 2048bits. We could transmit that with 256B of data. Surely we can find ways to use fewer intermediate signers and also reduce the size of these certificates?

Certificate Authorities are Difficult to Trust Verisign and others might claim that most of this overhead is necessary to provide integrity and all the features of SSL. But is the integrity that we get really that much better than a leaner PGP-like system? The browser today has dozens of root trust points, with those delegating trust authority to hundreds more. Chinaâ€™s government is trusted by browsers today to sign certificates for google.com, or even facebook.com. Do we trust them all?

A PGP model could reduce the size of the Certificates, provide decentralization so that we could enforce revocation lists, and eliminate worries about trusting China, the Iranian government, the US government, or any dubious entities that have signature authority today.

Better Browser Implementations I mentioned above about the flaw where the browser will simultaneously open multiple connections to a single site when it knows it doesnâ€™t have the serverâ€™s certificate, and thus redundantly download potentially large certs. All browsers need to be smarter. Although I expressed my grievances against the OCSP model above, it is used today. If browsers continue to use OCSP, they need to fully implement OCSP caching on the client, they need to support OCSP stapling, and they need to help push the OCSP multi-stapling forward.

SSL Handshake Round TripsThe round trips in the handshake are tragic. Fortunately, we can remove one, and Chrome users get this for free thanks to SSL False Start. False Start is a relatively new, client-side only change. Weâ€™ve measured that it is effective at removing one round trip from the handshake, and that it can reduce page load times by more than 5%.

Hopefully I got all that right, if you read this far, you deserve a medal.

Here are some results of benchmarking on my home computer. It shows that Chrome is still much faster than IE9 on all major JavaScript benchmarks. The IE 32bit version is a little better, but Win7 64bit is outselling Win7 32bit by a 3:1 margin, so this is what many users will experience.

My system is a Intel Core 2 Duo E6550 @2.33GHz with 4GB of RAM running Win7 Build 7600. The version of IE tested was 9.0.8080.16413 64bit and the version of Chrome was 10.0.648.204.

Our legislators all claim they want to spend less. But every time they attempt a plan for fiscal responsibility, they get sidetracked on who-wants-to-cut-what.

If they are serious about our finances, they have to stop debating which programs to cut (Planned Parenthood, Medicare, the Military, etc), and instead focus on the budget itself. This means unilateral cuts, blind to the programs, and simply trim everything equally.

Here is my simple proposal to balance the budget over 8 years (2013 to 2020):

Federal Spending in 2010 was ~$3.5T with revenues of ~$2.1T. To make these changes in 2013-2020, we need to cut $1.4T per year. We will accomplish this by reducing spending by $175B annually, additively.

Each year, the budget dictates the proportion of money spent for each line item. If the total budget exceeds the values from (2), spending per line item will be reduced proportionally such that total spending equals the value of line (2).

These spending cuts are mandatory, and override any previously guaranteed benefits to any programs. All federal programs will need to adjust to the new spending caps.

If, in any year, there is a surplus in revenues, the spending caps outlined in (2) will remain, and the surplus will be used to reduce the overall debt.

After the year 2020, annual spending will be capped at the total revenue of the previous year, and the budget balancing process of line (3) will be applied with the new spending cap.

This solution removes the politically charged plans where our legislators always get tripped up. This is liberating for all legislators, as they can now focus on getting the job done and balancing the budget in 8 years. No problem, right?