Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

the callback function is not called by PEM_read_PrivateKey

105 views
Skip to first unread message

jackz...@gmail.com

unread,
May 12, 2017, 12:12:11 AM5/12/17
to
Hi there,

I encountered a problem with PEM_read_PrivateKey that did not call the password callback function I passed into.
the pseudo code is like this:

static int pass_cb(char* buf, int size, int rwflag, void* u){
int len = strlen((const char*)u);
memcpy(buf, u, len);
return len;
}


EVP_PKEY pkey = PEM_read_PrivateKey(fp, NULL, pass_cb, "password");

the code above works if no password set in the private key pem file. But when I set the password it fails to read and return NULL. What I confuse is the callback function is never called.

How can I solve it? Thanks in advance.

The way of generating the private key pem file is:
openssl genrsa -des3 -out XXXX 2048

Jack Huang

unread,
May 16, 2017, 12:07:11 AM5/16/17
to
No one replies but I resolve this problem.

The reason that callback function does not work is that I did not call to load the algorithm. After I added to call OpenSSL_add_all_algorithm function, the callback function was called.

I found that the answer always in the source code of openssl.

Robert Rodriguez

unread,
Jul 19, 2023, 7:25:15 AM7/19/23
to
As time goes by, it’s normal for parts of your garage door https://garagedoorrepairlaurel.com/garage-door-replacement/ to get worn and in need of replacement.

Breaking Bad

unread,
Jul 19, 2023, 12:35:55 PM7/19/23
to
Https://rewritetool.net
about this topic you can read more on this link very helpfull

0 new messages