<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN" "http://www.w3.org/TR/REC-html40/loose.dtd">
<html lang="en">
<head>
<meta content="text/html; charset=US-ASCII" http-equiv="Content-Type">
<title>
GitLab
</title>


<style>img {
max-width: 100%; height: auto;
}
</style>
</head>
<body>
<div class="content">

<p class="details" style="font-style: italic; color: #777;">
<a href="https://gitlab.com/codesquid">Tim Kosse</a> created an issue <a href="https://gitlab.com/gnutls/gnutls/-/issues/1012">#1012</a>:
</p>
<div></div>
<h2 dir="auto">
<a id="user-content-description-of-the-feature" class="anchor" href="#description-of-the-feature" aria-hidden="true"></a>Description of the feature:</h2>
<p dir="auto">When looking at the fix for <a href="https://gitlab.com/gnutls/gnutls/-/issues/1008" data-original="#1008" data-link="false" data-link-reference="false" data-project="179611" data-issue="35220797" data-reference-type="issue" data-container="body" data-placement="top" data-html="true" title="Handle expiration of AddTrust root certificate (urgent)" class="gfm gfm-issue has-tooltip">#1008</a> I realized that there does not appear to be a function to return the actual used certificate path to a trusted CA for a given session. The certificate path that eventually leads to a successful gnutls_certificate_verify_peers() may be different from the certificates sent by the server and subsequently returned by gnutls_certificate_get_peers(). Not only can the raw list be out of order, it may also contain CA certificates that aren't part of a path to a trusted root.</p>
<p dir="auto">This is confusing when trying to understand why a particular certificate(-chain) is trusted, especially if there is something wrong with the CA certificates sent by the server, as is the case with e.g. support.sectigo.com sending expired CA certificates. The output of certtool unfortunately is not very helpful either when given the certificates sent by this server:</p>
<pre class="code highlight js-syntax-highlight plaintext" lang="plaintext" v-pre="true"><code><span id="LC1" class="line" lang="plaintext">$ certtool --verify --infile support.sectigo.com.pem </span>
<span id="LC2" class="line" lang="plaintext">Note that no verification profile was selected. In the future the medium profile will be enabled by default.</span>
<span id="LC3" class="line" lang="plaintext">Use --verify-profile low to apply the default verification of NORMAL priority string.</span>
<span id="LC4" class="line" lang="plaintext">Loaded system trust (128 CAs available)</span>
<span id="LC5" class="line" lang="plaintext">       Subject: CN=COMODO RSA Certification Authority,O=COMODO CA Limited,L=Salford,ST=Greater Manchester,C=GB</span>
<span id="LC6" class="line" lang="plaintext">       Issuer: CN=AddTrust External CA Root,OU=AddTrust External TTP Network,O=AddTrust AB,C=SE</span>
<span id="LC7" class="line" lang="plaintext">       Checked against: CN=AddTrust External CA Root,OU=AddTrust External TTP Network,O=AddTrust AB,C=SE</span>
<span id="LC8" class="line" lang="plaintext">       Signature algorithm: RSA-SHA384</span>
<span id="LC9" class="line" lang="plaintext">       Output: Not verified. The certificate is NOT trusted. The certificate chain uses expired certificate. </span>
<span id="LC10" class="line" lang="plaintext"></span>
<span id="LC11" class="line" lang="plaintext">      Subject: CN=COMODO RSA Certification Authority,O=COMODO CA Limited,L=Salford,ST=Greater Manchester,C=GB</span>
<span id="LC12" class="line" lang="plaintext">      Issuer: CN=AddTrust External CA Root,OU=AddTrust External TTP Network,O=AddTrust AB,C=SE</span>
<span id="LC13" class="line" lang="plaintext">      Checked against: CN=COMODO RSA Certification Authority,O=COMODO CA Limited,L=Salford,ST=Greater Manchester,C=GB</span>
<span id="LC14" class="line" lang="plaintext">      Signature algorithm: RSA-SHA384</span>
<span id="LC15" class="line" lang="plaintext">      Output: Verified. The certificate is trusted. </span>
<span id="LC16" class="line" lang="plaintext"></span>
<span id="LC17" class="line" lang="plaintext">      Subject: CN=COMODO RSA Extended Validation Secure Server CA,O=COMODO CA Limited,L=Salford,ST=Greater Manchester,C=GB</span>
<span id="LC18" class="line" lang="plaintext">      Issuer: CN=COMODO RSA Certification Authority,O=COMODO CA Limited,L=Salford,ST=Greater Manchester,C=GB</span>
<span id="LC19" class="line" lang="plaintext">      Checked against: CN=COMODO RSA Certification Authority,O=COMODO CA Limited,L=Salford,ST=Greater Manchester,C=GB</span>
<span id="LC20" class="line" lang="plaintext">      Signature algorithm: RSA-SHA384</span>
<span id="LC21" class="line" lang="plaintext">      Output: Verified. The certificate is trusted. </span>
<span id="LC22" class="line" lang="plaintext"></span>
<span id="LC23" class="line" lang="plaintext">      Subject: CN=support.sectigo.com,OU=COMODO EV SSL,OU=IT,O=Comodo CA Limited,street=3rd Floor Building 26,street=Office Village Exchange Quay,street=Trafford Road,L=Salford,ST=Manchester,postalCode=M5 3EQ,C=GB,businessCategory=Private Organization,jurisdictionOfIncorporationCountryName=GB,serialNumber=04058690</span>
<span id="LC24" class="line" lang="plaintext">      Issuer: CN=COMODO RSA Extended Validation Secure Server CA,O=COMODO CA Limited,L=Salford,ST=Greater Manchester,C=GB</span>
<span id="LC25" class="line" lang="plaintext">      Checked against: CN=COMODO RSA Extended Validation Secure Server CA,O=COMODO CA Limited,L=Salford,ST=Greater Manchester,C=GB</span>
<span id="LC26" class="line" lang="plaintext">      Signature algorithm: RSA-SHA256</span>
<span id="LC27" class="line" lang="plaintext">      Output: Verified. The certificate is trusted. </span>
<span id="LC28" class="line" lang="plaintext"></span>
<span id="LC29" class="line" lang="plaintext">Chain verification output: Verified. The certificate is trusted. </span></code></pre>
<p dir="auto"><a href="https://gitlab.com/gnutls/gnutls/uploads/b39012da314113bb31b6980c072eca80/support.sectigo.com.pem" data-link="true" class="gfm">support.sectigo.com.pem</a></p>
<p dir="auto">I suggest adding a function that returns the full path to the trusted root as was used in gnutls_certificate_verify_peers.</p>
<h2 dir="auto">
<a id="user-content-applications-that-this-feature-may-be-relevant-to" class="anchor" href="#applications-that-this-feature-may-be-relevant-to" aria-hidden="true"></a>Applications that this feature may be relevant to:</h2>
<p dir="auto">Any programs that displays certificate paths, such as web browsers.</p>
<h2 dir="auto">
<a id="user-content-is-this-feature-implemented-in-other-libraries-and-which" class="anchor" href="#is-this-feature-implemented-in-other-libraries-and-which" aria-hidden="true"></a>Is this feature implemented in other libraries (and which)</h2>
<p dir="auto">I believe NSS implements this feature. Viewing the certificate path of support.sectigo.com in Firefox shows a path with a valid root CA, even though the server sends a chain with expired certificates.</p>

</div>
<div class="footer" style="margin-top: 10px;">
<p style="font-size: small; color: #777;">

<br>
Reply to this email directly or <a href="https://gitlab.com/gnutls/gnutls/-/issues/1012">view it on GitLab</a>.
<br>
You're receiving this email because of your account on gitlab.com.
If you'd like to receive fewer emails, you can
<a href="https://gitlab.com/-/sent_notifications/6f84dfdbf4b1ae51d1d91cb97617ab8b/unsubscribe">unsubscribe</a>
from this thread or
adjust your notification settings.
<script type="application/ld+json">{"@context":"http://schema.org","@type":"EmailMessage","action":{"@type":"ViewAction","name":"View Issue","url":"https://gitlab.com/gnutls/gnutls/-/issues/1012"}}</script>


</p>
</div>
</body>
</html>