<div dir="ltr">I'm pretty sure you need the root also, not just the intermedia ca...<div>I use a custom generated chain... I encode the root cert in the application, and then pass it when inintializing the client socket.</div><div><br></div><div>This bit of code takes the root cert and adds it to the SSL_CTX the client socket is created from....</div><div><a href="https://github.com/d3x0r/SACK/blob/master/src/netlib/ssl_layer.c#L704">https://github.com/d3x0r/SACK/blob/master/src/netlib/ssl_layer.c#L704</a><br></div><div>( if no root passed, it loads root certs from windows store; haven't finished linux load cert store)</div><div><br></div><div>THis is where the cert chain is verified....</div><div><a href="https://github.com/d3x0r/SACK/blob/master/src/netlib/ssl_layer.c#L264">https://github.com/d3x0r/SACK/blob/master/src/netlib/ssl_layer.c#L264</a><br></div><div><br></div><div>looking at that, I guess I should split that if and fail if it fails to get the peer certificate...</div></div><div class="gmail_extra"><br><div class="gmail_quote">On Mon, Dec 11, 2017 at 3:03 PM, Dr. Pala <span dir="ltr"><<a href="mailto:madwolf@openca.org" target="_blank">madwolf@openca.org</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Hi Victor,<br>
<br>
thanks :D I just tried to set it and I get a different error now : 22 (certificate chain too long)... I suspect it is a side effect of using theĀ  X509_V_FLAG_PARTIAL_CHAIN flag... ? (no chain restrictions are set in the certificates themselves...), but I have not dug into the vfy code yet...<br>
<br>
... any suggestion on how to fix this ? Do you think it is actually a bug ? ... or am I missing some other configs / setting I should have done for the verify param ?<br>
<br>
Cheers,<br>
Max<span class="im HOEnZb"><br>
<br>
<br>
On 12/11/17 3:18 PM, Viktor Dukhovni wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
On Dec 11, 2017, at 5:06 PM, Dr. Pala <<a href="mailto:director@openca.org" target="_blank">director@openca.org</a>> wrote:<br>
<br>
Hi all,<br>
<br>
I am trying to verify a certificate and provide the possibility to directly trust an intermediate CA's certificate (not self-signed). After setting up the STORE and STORE_CTX and add the intermediate CA to the trusted certificates, when I use the "X509_verify_cert(ctx)" I get the usual "unable to get issuer certificate" - which would be fine for a "non-trusted" cert, but I would expect that to not be an issue for a trusted certificate.<br>
<br>
Therefore, my question is what is the best method to have that behavior ?<br>
<br>
I tried to use the certificate callback to do that, but there is no function to get the trusted certificates' stack (i.e., there is a X509_STORE_CTX_get0_untrusted(<wbr>) but there is no equivalent for the trusted certificates' stack) - so I could not verify if the current certificate (in the verify callback call) is in the trusted stack or not...<br>
<br>
Maybe there are flags / trust settings that can be used instead ?<br>
</blockquote>
It seems we've neglected to document the X509_V_FLAG_PARTIAL_CHAIN<br>
flag, which can be passed to X509_VERIFY_PARAM_set_flags() to<br>
permit intermediate trust-anchors.<br>
<br>
<a href="https://www.openssl.org/docs/man1.0.2/crypto/X509_VERIFY_PARAM_set_flags.html" rel="noreferrer" target="_blank">https://www.openssl.org/docs/m<wbr>an1.0.2/crypto/X509_VERIFY_PAR<wbr>AM_set_flags.html</a><br>
<a href="https://www.openssl.org/docs/man1.1.0/crypto/X509_VERIFY_PARAM_set_flags.html" rel="noreferrer" target="_blank">https://www.openssl.org/docs/m<wbr>an1.1.0/crypto/X509_VERIFY_PAR<wbr>AM_set_flags.html</a><br>
<br>
<br>
</blockquote>
<br>
-- <br></span><div class="HOEnZb"><div class="h5">
openssl-users mailing list<br>
To unsubscribe: <a href="https://mta.openssl.org/mailman/listinfo/openssl-users" rel="noreferrer" target="_blank">https://mta.openssl.org/mailma<wbr>n/listinfo/openssl-users</a><br>
</div></div></blockquote></div><br></div>