Hi, I'm trying to use the encrypted private key for my test SSL server. I generated an encrypted private key cert_27.key using genrsa tool and I gave a paswd to it. I wrote a call back function as follows, which just stores my passwd into buf character buffer. static int password_callback(char *buf, int size, int rwflag, void *userdata) { /* For the purposes of this demonstration, the password is "ibmdw" */ printf("*** Callback function called\n"); strcpy(buf, "ibmdw"); return 1; }
Now, I tried to load the private key in my server application as follows int main() { SSL_CTX *ctx; SSL *ssl, *ssl1; BIO *bio, *abio, *out; int p; char r[1024]; CRYPTO_malloc_init(); SSL_library_init(); SSL_load_error_strings(); ERR_load_BIO_strings(); ERR_load_SSL_strings(); OpenSSL_add_all_algorithms(); printf("Attempting to create SSL context... "); ctx = SSL_CTX_new(SSLv23_server_method()); if(ctx == NULL) { printf("Failed. Aborting.\n"); return 0; } printf("\nLoading certificates...\n"); SSL_CTX_set_default_passwd_cb(ctx, &password_callback); if(!SSL_CTX_use_certificate_file(ctx, "signedcert_27.pem", SSL_FILETYPE_PEM)) { ERR_print_errors_fp(stdout); SSL_CTX_free(ctx); return 0; } printf("\nLoading Private key...\n"); if(!SSL_CTX_use_PrivateKey_file(ctx, "cert_27.key", SSL_FILETYPE_PEM)) { ERR_print_errors_fp(stdout); SSL_CTX_free(ctx); return 0; } } when executing this application, i get the following runtime error in the function, SSL_CTX_use_PrivateKey_file OPENSSL_Uplink(100EB010,07): no OPENSSL_Applink. When I comment the SSL_CTX_set_default_passwd_cb() line. The executable is running, it asks for pem passphrase. When I enter the password, everything is fine. But, I did not want this behaviour as I need to enter the passwd from screen. I would appriciate if I get nay comments on this. Thanks and Regards, Renuga. --------------------------------- Access over 1 million songs - Yahoo! Music Unlimited.