Rebuild a cleaner certificates chain before validating it.
This change cleans the server certificates: 1. Use the end-entity certificate as found in the chain received from the server as the end-entity cert for the newly built chain. 2. Look at the last cert in the newly built chain, specifically it's "issuer" field. If there's a cert in the chain as received with this as the "subject", and this cert hasn't yet been moved into the newly built chain, move it there (as the new last cert). Repeat this step 2 until you can't continue (because there's no matching previously unused cert left). 3. If the last certificate in the new chain has expired (and it's not the end-entity cert), remember this fact, and remove it (so that we can try if we can validating the chain for a different root). If in this case it turns out that we still can't validate the chain, it's probably the cert expiry error that should be displayed. This CL also cleans the redundant error detection code and reduces the error messages to two types, which are the only two make differences to the user: a. SSL_IDMISMATCH for name mismatch, b. SSL_UNTRUSTED for other reasons.
Loading
Please register or sign in to comment