@Gerardo, I'm having a problem with this function and I will use your thread for some support.
@All The problem I've got is quite simple. The callback I pass throught this function is not called. I inserted a breakpoint into cb and it's not called at all. I'm using OpenSSL 1.0.1c. I'm sure about it (My App gets OpenSSL version, now). Someone could please help me figure out why? I've wrote as OpenSSL page tells. Am I doing something wrong? Is thera a best way for doing this? Thanks, Leonardo My code (c++): #include "openssl/bio.h" #include "openssl/err.h" #include "openssl/evp.h" #include "openssl/pem.h" EVP_PKEY *pkey; BIO *bio; typedef struct pw_cb_data { const void *password; const char *prompt_info; } PW_CB_DATA; static int rsa_cb(char *buf, int size, int rwflag, void *u) { int len; PW_CB_DATA *cb_data = (PW_CB_DATA *)u; //Programm doesn't enter here!! len = strlen((char *)cb_data->password); if (len <= 0) return 0; /* if too long, truncate */ if (len > size) len = size; memcpy(buf, cb_data->password, len); return len; } int main() { PW_CB_DATA cb_data; int ret = 1; (...) memcpy(&kprPath[0],"path_to_Kpr",pathlen); kprPath[pathlen] = '\0'; memcpy(&kprPath[0],"Kpr_password",passlen); kprPath[passlen] = '\0'; if (ret) bio = BIO_new(BIO_s_file()); if (bio == NULL) ret = 0; if (ret && !BIO_read_filename(bio,&kprPath[0])) ret = 0; cb_data.password = &passwd[0]; cb_data.prompt_info = &kprPath[0]; if (ret) pkey=PEM_read_bio_PrivateKey(bio,NULL,(pem_password_cb *)rsa_cb, &cb_data); if (pkey != NULL) ret = 0; //ret is equal 0 and pkey is NULL here. (...) return ret; } ______________________________________________________________________ OpenSSL Project http://www.openssl.org User Support Mailing List openssl-users@openssl.org Automated List Manager majord...@openssl.org