<!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=utf-8" http-equiv="Content-Type">
<title>
GitLab
</title>


<style>img {
max-width: 100%; height: auto;
}
</style>
</head>
<body>
<div class="content">
<div></div>
<p dir="auto">In "lib/x509/verify.c" <code>is_issuer()</code> uses <code>_gnutls_x509_compare_raw_dn()</code> but that doesn't account for different text encodings of the DN. We have a CA that has a Subject that looks like this when dumped with <code>openssl asn1parse -i</code>:</p>
<pre class="code highlight js-syntax-highlight plaintext" lang="plaintext" v-pre="true"><code><span id="LC1" class="line" lang="plaintext">  159:d=2  hl=2 l=  91 cons:   SEQUENCE</span>
<span id="LC2" class="line" lang="plaintext">  161:d=3  hl=2 l=  33 cons:    SET</span>
<span id="LC3" class="line" lang="plaintext">  163:d=4  hl=2 l=  31 cons:     SEQUENCE</span>
<span id="LC4" class="line" lang="plaintext">  165:d=5  hl=2 l=   3 prim:      OBJECT            :organizationName</span>
<span id="LC5" class="line" lang="plaintext">  170:d=5  hl=2 l=  24 prim:      PRINTABLESTRING   :<censored org></span>
<span id="LC6" class="line" lang="plaintext">  196:d=3  hl=2 l=  22 cons:    SET</span>
<span id="LC7" class="line" lang="plaintext">  198:d=4  hl=2 l=  20 cons:     SEQUENCE</span>
<span id="LC8" class="line" lang="plaintext">  200:d=5  hl=2 l=   3 prim:      OBJECT            :organizationalUnitName</span>
<span id="LC9" class="line" lang="plaintext">  205:d=5  hl=2 l=  13 prim:      PRINTABLESTRING   :<censored unit></span>
<span id="LC10" class="line" lang="plaintext">  220:d=3  hl=2 l=  30 cons:    SET</span>
<span id="LC11" class="line" lang="plaintext">  222:d=4  hl=2 l=  28 cons:     SEQUENCE</span>
<span id="LC12" class="line" lang="plaintext">  224:d=5  hl=2 l=   3 prim:      OBJECT            :commonName</span>
<span id="LC13" class="line" lang="plaintext">  229:d=5  hl=2 l=  21 prim:      PRINTABLESTRING   :Certificate Authority</span>
<span id="LC14" class="line" lang="plaintext">  252:d=2  hl=4 l= 338 cons:   SEQUENCE</span></code></pre>
<p dir="auto">We have a cert that is signed by the CA. It has an Issuer section that looks like this when dumped:</p>
<pre class="code highlight js-syntax-highlight plaintext" lang="plaintext" v-pre="true"><code><span id="LC1" class="line" lang="plaintext">   36:d=2  hl=2 l=  91 cons:   SEQUENCE</span>
<span id="LC2" class="line" lang="plaintext">   38:d=3  hl=2 l=  33 cons:    SET</span>
<span id="LC3" class="line" lang="plaintext">   40:d=4  hl=2 l=  31 cons:     SEQUENCE</span>
<span id="LC4" class="line" lang="plaintext">   42:d=5  hl=2 l=   3 prim:      OBJECT            :organizationName</span>
<span id="LC5" class="line" lang="plaintext">   47:d=5  hl=2 l=  24 prim:      UTF8STRING        :<censored org></span>
<span id="LC6" class="line" lang="plaintext">   73:d=3  hl=2 l=  22 cons:    SET</span>
<span id="LC7" class="line" lang="plaintext">   75:d=4  hl=2 l=  20 cons:     SEQUENCE</span>
<span id="LC8" class="line" lang="plaintext">   77:d=5  hl=2 l=   3 prim:      OBJECT            :organizationalUnitName</span>
<span id="LC9" class="line" lang="plaintext">   82:d=5  hl=2 l=  13 prim:      UTF8STRING        :<censored unit></span>
<span id="LC10" class="line" lang="plaintext">   97:d=3  hl=2 l=  30 cons:    SET</span>
<span id="LC11" class="line" lang="plaintext">   99:d=4  hl=2 l=  28 cons:     SEQUENCE</span>
<span id="LC12" class="line" lang="plaintext">  101:d=5  hl=2 l=   3 prim:      OBJECT            :commonName</span>
<span id="LC13" class="line" lang="plaintext">  106:d=5  hl=2 l=  21 prim:      UTF8STRING        :Certificate Authority</span></code></pre>
<p dir="auto">The strings match, but the CA is encoded as <code>PRINTABLESTRING</code> and the cert uses <code>UTF8STRING</code> and so the binary DN comparison fails, and the cert doesn't verify. I believe this is incorrect behavior.</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/553">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/fa088fc208607ebffcdd8552643f521e/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/553"}}</script>
</p>
</div>
</body>
</html>