On Wed, Jul 27, 2016 at 09:28:55PM +0530, john gloster wrote:

> Can we use both the following APIs in the same application to load
> certificate to the SSL context?
> 
> *SSL_CTX_use_certificate_file()*
> *SSL_CTX_use_certificate_chain_file()*

For any given certificate chain use either one or the other, but
in many cases SSL_CTX_use_certificate_chain_file() is the more
convenient choice.

> If we can how to use them?

    ERR_clear_error();
    if (SSL_CTX_use_certificate_chain_file(ctx, cert_file) <= 0) {
        /* Handle error */
    }
    if (SSL_CTX_use_PrivateKey_file(ctx, key_file, SSL_FILETYPE_PEM) <= 0) {
        /* Handle error */
    }
    if (!SSL_CTX_check_private_key(ctx)) {
        /* Handle error */
    }
    /* Success */

See the SSL_CTX_use_certificate(3) manpage for a more detailed
description.

-- 
        Viktor.
-- 
openssl-users mailing list
To unsubscribe: https://mta.openssl.org/mailman/listinfo/openssl-users

Reply via email to