On 05/18/2012 06:03 AM, kthiru...@inautix.co.in wrote:
Team,

Had a query in the certs that we load,

The CA's provide our certs in .p12 format, which we need to convert to a .pem and load to SSL structure during initialization.
On converting to .pem, it is in the following format, "Private Key, CA Certs and 
Domain Certificate".

In our code, we use the below snippet to load keys in in SSL structure,

1. err =  SSL_CTX_use_certificate_chain_file(ctx, KeyFile);
2. SSL_CTX_set_default_passwd_cb(ctx, passwd);
3. err = SSL_CTX_use_PrivateKey_file(ctx, KeyFile, SSL_FILETYPE_PEM);
4. SSL_CTX_check_private_key(ctx);

When i use the same order in the key ( "Private Key, CA Certs and Domain Certificate" ), the above fails in step 3. So we have to rearrange this order to "Domain Certificate, Private Key and CA Certs" for the above snippet to work properly.

We are trying to reduce the effort here, for someone to rearrange this cert 
order.
Can you suggest some other way to convert the certs as expected by the code or change the order of our code.
load the P12 file directly in your code

Reply via email to