Open Bug 1547617 Opened 3 years ago Updated 3 years ago

Improve certificate selection logic


(NSS :: Libraries, enhancement, P2)



(Not tracked)


(Reporter: mt, Unassigned)



When SSL_ConfigServerCert was introduced, it was built to mimic the SSL_ConfigSecureServer[WithCertChain] API. The now-deprecated API places certificates into slots based on SSLKEAType, which doesn't fit with our use of SSLAuthType for signaling how the connection was authenticated.

Things are even more complicated with the addition of two extensions for signaling which signature schemes are used in TLS 1.3 (signature_scheme and signature_scheme_cert). Delegated credentials (draft-ietf-tls-subcerts) adds another wrinkle to the certificate selection business. There, a server might want to offer several types of delegated credential.

Rather than try to slot certificates, we should just throw all certificates into a list and pick the first that works. This would allow us to configure the same certificate multiple ways (with different delegated credentials, for instance).

The primary cost here is to the deprecated API. For instance, SSL_SetStapledOCSPResponses uses SSLKEATYpe to target a certificate. If there are multiple such certificates, we would have to decide on what happens. I propose the following for those (deprecated) APIs:

  • SSL_ConfigSecureServer[WithCertChain] will find all "matching" configurations and remove them. Then a single entry will be created.

  • SSL_SetStapledOCSPResponses and SSL_SetSignedCertTimestamps will find the first "matching" configuration and update that.

This is very similar to what that code does today and will only cause problems if the new API is used.

The biggest change here is to SSL_ConfigServerCert, which will no longer "replace" an existing entry. The question is whether we want to have newer entries appear before older entries so that the effect of inserting similar entries is that the most recently entered is used. That would result in looking like replacement for the simple cases we currently support. However, it would result in code that configures certificates needing to use an unusual ordering, with the highest priority certificate being added last.

As SSL_ConfigServerCert is in ssl.h (and not sslexp.h), I think that the unusual ordering option is probably best. So newer entries will be inserted ahead of older ones.

Priority: -- → P2
You need to log in before you can comment on or make changes to this bug.