hi,
I am using openSSL 0.9.5a 1 Apr 2000. Here, I have observed a thing:

#include <openssl/ssl.h>
#include <openssl/err.h>
#include <stdio.h>

main()
{
        SSL_CTX *myCtx = NULL;
        SSL     *mySSL = NULL;
        SSL_METHOD *myReqMethod = SSLv2_client_method();

        if (SSL_library_init() != 1) {
                printf("SSL library initialization failed\n");
                return;
        }

        myCtx = SSL_CTX_new(myReqMethod);
        mySSL = SSL_new(myCtx);
        if (!mySSL) {
                printf("SSL_new failed\n");
                return;
        }

        //set the private key file
        if (1 !=
SSL_CTX_use_PrivateKey_file(myCtx,"myclient.key",SSL_FILETYPE_PEM)) {
                printf("Setting Private Key file failed\n");
                return;
        }

        printf ("Private Key file set....\n");

        //set the certificate
        if (1 !=
SSL_CTX_use_certificate_file(myCtx,"myclient.crt",SSL_FILETYPE_PEM)) {
                printf("Setting Certification file failed\n");
                return;
        }

        printf ("Certification file set....\n");
        return;
}

The above code runs fine. If I run it I get 
Private Key file set....
Certification file set....

But, if i change the order of setting, i.e. if I set Certificate file first
and then the private key file, I get the following output:
Certification file set....
Setting Private Key file failed

Can anybody write me in what case this ordering matters.

thanks & regards
Ajit
______________________________________________________________________
OpenSSL Project                                 http://www.openssl.org
User Support Mailing List                    [EMAIL PROTECTED]
Automated List Manager                           [EMAIL PROTECTED]

Reply via email to