Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

sslkeypass not working #297

Closed
miglio opened this issue Oct 25, 2016 · 1 comment
Closed

sslkeypass not working #297

miglio opened this issue Oct 25, 2016 · 1 comment

Comments

@miglio
Copy link

miglio commented Oct 25, 2016

The private key passphrase is not working.
Looking into the ssl.c file I edited the following function:

#ifdef HAVE_OPENSSL

static int _openssl_passwd(char *buf, int size, int rwflag, void *ud) {
  strlcpy(buf, _options.sslkeypass, size);
  memset(_options.sslkeypass,'x',strlen(_options.sslkeypass));
  return 0;
}
#endif

and modified the return code to strlen(buf). now it works.

The wiki for openssl say:

The pem_passwd_cb(), which must be provided by the application, hands back the password to be used during decryption. On invocation a pointer to userdata is provided. The pem_passwd_cb must write the password into the provided buffer buf which is of size size. The actual length of the password must be returned to the calling function. rwflag indicates whether the callback is used for reading/decryption (rwflag=0) or writing/encryption (rwflag=1).

Source: https://wiki.openssl.org/index.php/Manual:SSL_CTX_set_default_passwd_cb(3)

@gbaligh
Copy link
Contributor

gbaligh commented Dec 8, 2016

That's 💯 % correct 😄 !

gbaligh added a commit to gbaligh/coova-chilli that referenced this issue Dec 9, 2016
This patch is about passphrase support in the openssl, which is contain
a problem in the password callback return value. This function must
return the length of the password to the calling function.
Thanks to @miglio

Signed-off-by: Baligh GUESMI <gasmibal@gmail.com>
sevan pushed a commit that referenced this issue Dec 9, 2016
This patch is about passphrase support in the openssl, which is contain
a problem in the password callback return value. This function must
return the length of the password to the calling function.
Thanks to @miglio

Signed-off-by: Baligh GUESMI <gasmibal@gmail.com>
@sevan sevan closed this as completed Dec 9, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants