Load CA Certificate to OpenSSL
<p>As we know while creating an <code>SSL</code> connection using openssl api's, we creates an <code>SSL_CTX</code> context object in which all certificates and keys are loaded.</p>

<p>To set up <strong>Peer Verification</strong>, we load the <strong>CA Certificate</strong> using <code>SSL_CTX_load_verify_locations</code> api (CA is stored in a file)</p>

<p>But now in my case CA is not in file, i have a <code>X509 *issuerCert</code>.
Now how to set this <code>issuerCert</code> in <code>SSL_CTX</code> object ?</p>

<p>I found this :-
<a href="https://stackoverflow.com/questions/5052563/c-openssl-use-root-ca-from-buffer-rather-than-file-ssl-ctx-load-verify-locat">C++/OpenSSL: Use root CA from buffer rather than file (SSL_CTX_load_verify_locations)</a></p>

<p>In above solution we are creating an <code>X509_STORE *</code> using <code>SSL_CTX_get_cert_store</code> and finally add the <code>X509 *issuerCert</code> in it.</p>

<p>Now i am confused here, since adding this cert to <code>X509_STORE *</code> add it in store only, how that cert information will be linked to <code>SSL_CTX</code> ?</p>

<p>Since ultimately we pass <code>SSL_CTX</code> to <code>SSL_connect</code> where all verification(handshaking) happens behind the scenes. So how that CA cert info
will reach to <code>SSL_connect</code> when using <code>SSL_CTX_get_cert_store</code> instead of
<code>SSL_CTX_load_verify_locations</code> ?</p>