jackz...@gmail.com
unread,May 12, 2017, 12:12:11 AM5/12/17Sign in to reply to author
Sign in to forward
You do not have permission to delete messages in this group
Sign in to report message as abuse
Either email addresses are anonymous for this group or you need the view member email addresses permission to view the original message
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