<html xmlns:v="urn:schemas-microsoft-com:vml" xmlns:o="urn:schemas-microsoft-com:office:office" xmlns:w="urn:schemas-microsoft-com:office:word" xmlns:m="http://schemas.microsoft.com/office/2004/12/omml" xmlns="http://www.w3.org/TR/REC-html40">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=us-ascii">
<meta name="Generator" content="Microsoft Word 14 (filtered medium)">
<style><!--
/* Font Definitions */
@font-face
{font-family:Calibri;
panose-1:2 15 5 2 2 2 4 3 2 4;}
@font-face
{font-family:Consolas;
panose-1:2 11 6 9 2 2 4 3 2 4;}
/* Style Definitions */
p.MsoNormal, li.MsoNormal, div.MsoNormal
{margin:0cm;
margin-bottom:.0001pt;
font-size:11.0pt;
font-family:"Calibri","sans-serif";
mso-fareast-language:EN-US;}
a:link, span.MsoHyperlink
{mso-style-priority:99;
color:blue;
text-decoration:underline;}
a:visited, span.MsoHyperlinkFollowed
{mso-style-priority:99;
color:purple;
text-decoration:underline;}
span.E-MailFormatvorlage17
{mso-style-type:personal-compose;
font-family:"Calibri","sans-serif";
color:windowtext;}
.MsoChpDefault
{mso-style-type:export-only;
mso-fareast-language:EN-US;}
@page WordSection1
{size:612.0pt 792.0pt;
margin:70.85pt 70.85pt 2.0cm 70.85pt;}
div.WordSection1
{page:WordSection1;}
--></style><!--[if gte mso 9]><xml>
<o:shapedefaults v:ext="edit" spidmax="1026" />
</xml><![endif]--><!--[if gte mso 9]><xml>
<o:shapelayout v:ext="edit">
<o:idmap v:ext="edit" data="1" />
</o:shapelayout></xml><![endif]-->
</head>
<body lang="DE" link="blue" vlink="purple">
<div class="WordSection1">
<p class="MsoNormal"><span lang="EN-US">Hello there,<o:p></o:p></span></p>
<p class="MsoNormal"><span lang="EN-US"><o:p> </o:p></span></p>
<p class="MsoNormal"><span lang="EN-US">I’m trying to do peer client verification using the
</span><span lang="EN-US" style="font-size:9.5pt;font-family:Consolas;color:black;background:white;mso-highlight:white">SSL_CTX_load_verify_locations</span><span lang="EN-US"> function in conjunction with the
</span><span lang="EN-US" style="font-size:9.5pt;font-family:Consolas;color:black;background:white;mso-highlight:white">SSL_get_peer_certificate</span><span lang="EN-US"> and
</span><span lang="EN-US" style="font-size:9.5pt;font-family:Consolas;color:black;background:white;mso-highlight:white">SSL_get_verify_result</span><span lang="EN-US"> function. If I
</span><span lang="EN-US" style="font-size:9.5pt;font-family:Consolas;color:black;background:white;mso-highlight:white">SSL_get_verify_result</span><span lang="EN-US"> call this way setting CAFile, it will work for me:<o:p></o:p></span></p>
<p class="MsoNormal"><span lang="EN-US"><o:p> </o:p></span></p>
<p class="MsoNormal"><span lang="EN-US"></span><span lang="EN-US" style="font-size:9.5pt;font-family:Consolas;color:black;background:white;mso-highlight:white">SSL_CTX_load_verify_locations(
</span><span lang="EN-US" style="font-size:9.5pt;font-family:Consolas;color:gray;background:white;mso-highlight:white">sslContext</span><span lang="EN-US" style="font-size:9.5pt;font-family:Consolas;color:black;background:white;mso-highlight:white">,
</span><span lang="EN-US" style="font-size:9.5pt;font-family:Consolas;color:#A31515;background:white;mso-highlight:white">"D:\\certs\\-.wikipedia.org.crt"</span><span lang="EN-US" style="font-size:9.5pt;font-family:Consolas;color:black;background:white;mso-highlight:white">,
</span><span lang="EN-US" style="font-size:9.5pt;font-family:Consolas;color:#6F008A;background:white;mso-highlight:white">NULL</span><span lang="EN-US" style="font-size:9.5pt;font-family:Consolas;color:black;background:white;mso-highlight:white">
</span><span lang="EN-US" style="font-size:9.5pt;font-family:Consolas;color:black">);<o:p></o:p></span></p>
<p class="MsoNormal"><span lang="EN-US" style="font-size:9.5pt;font-family:Consolas;color:black"><o:p> </o:p></span></p>
<p class="MsoNormal"><span lang="EN-US" style="font-size:9.5pt;font-family:Consolas;color:black">However, setting only CAPath will not:<o:p></o:p></span></p>
<p class="MsoNormal"><span lang="EN-US" style="font-size:9.5pt;font-family:Consolas;color:black"><o:p> </o:p></span></p>
<p class="MsoNormal"><span lang="EN-US" style="font-size:9.5pt;font-family:Consolas;color:black;background:white;mso-highlight:white">SSL_CTX_load_verify_locations(
</span><span lang="EN-US" style="font-size:9.5pt;font-family:Consolas;color:gray;background:white;mso-highlight:white">sslContext</span><span lang="EN-US" style="font-size:9.5pt;font-family:Consolas;color:black;background:white;mso-highlight:white">,
</span><span lang="EN-US" style="font-size:9.5pt;font-family:Consolas;color:#6F008A;background:white;mso-highlight:white">NULL</span><span lang="EN-US" style="font-size:9.5pt;font-family:Consolas;color:black;background:white;mso-highlight:white">,
</span><span lang="EN-US" style="font-size:9.5pt;font-family:Consolas;color:#A31515;background:white;mso-highlight:white">"D:\\certs"</span><span lang="EN-US" style="font-size:9.5pt;font-family:Consolas;color:black;background:white;mso-highlight:white"> );</span><span lang="EN-US" style="font-size:9.5pt;font-family:Consolas;color:black"><o:p></o:p></span></p>
<p class="MsoNormal"><span lang="EN-US" style="font-size:9.5pt;font-family:Consolas;color:black"><o:p> </o:p></span></p>
<p class="MsoNormal"><span lang="EN-US" style="font-size:9.5pt;font-family:Consolas;color:black">This will result in a
</span><b><span lang="EN-US">X509_V_ERR_UNABLE_TO_GET_ISSUER_CERT_LOCALLY</span></b><span lang="EN-US" style="font-size:9.5pt;font-family:Consolas;color:black"> error.<o:p></o:p></span></p>
<p class="MsoNormal"><span lang="EN-US" style="font-size:9.5pt;font-family:Consolas;color:black"><o:p> </o:p></span></p>
<p class="MsoNormal"><span lang="EN-US" style="font-size:9.5pt;font-family:Consolas;color:black">The cert directory D:\\certs looks like this:<o:p></o:p></span></p>
<p class="MsoNormal"><span lang="EN-US" style="font-size:9.5pt;font-family:Consolas;color:black"><o:p> </o:p></span></p>
<p class="MsoNormal"><span lang="EN-US" style="font-size:9.5pt;font-family:Consolas;color:black">-.wikipedia.org.crt<o:p></o:p></span></p>
<p class="MsoNormal"><span lang="EN-US">ca_client.jks<o:p></o:p></span></p>
<p class="MsoNormal"><span lang="EN-US">ca_server.jks<o:p></o:p></span></p>
<p class="MsoNormal"><span lang="EN-US"><o:p> </o:p></span></p>
<p class="MsoNormal"><span lang="EN-US">My expectation would be that the library uses
</span><span lang="EN-US" style="font-size:9.5pt;font-family:Consolas;color:black">-.wikipedia.org.crt<o:p></o:p></span></p>
<p class="MsoNormal"><span lang="EN-US">As it is the only certificate available or am I doing something wrong?<o:p></o:p></span></p>
<p class="MsoNormal"><span lang="EN-US"><o:p> </o:p></span></p>
<p class="MsoNormal"><span lang="EN-US">API is openssl-1.0.2c.<o:p></o:p></span></p>
<p class="MsoNormal"><span lang="EN-US"><o:p> </o:p></span></p>
<p class="MsoNormal"><span lang="EN-US">Regards<o:p></o:p></span></p>
</div>
</body>
</html>