title: OpenSSL - SSL_CTX_set_default_passwd_cb
body: <p>I'm needing to write a simple SSL client application to query the Amazon Web Service from C++.  It's going to be used in multi-threaded applications.</p>
  
  <p>This is the first time I've ever looked at using OpenSSL and I'm needing to extend some of our our libraries to support SSL sockets.</p>
  
  <p>My question is: What is the purpose of the <a href="http://www.openssl.org/docs/ssl/SSL_CTX_set_default_passwd_cb.html" rel="nofollow">SSL_CTX_set_default_passwd_cb</a> function in OpenSSL?  </p>
  
  <p>In reading the man page it's not particularly clear what it does exactly.  As suggested function from the man page is this.</p>
  
  <pre><code>int pem_passwd_cb(char *buf, int size, int rwflag, void *password)
  {
      strncpy(buf, (char *)(password), size);
      buf[size - 1] = '\0';
      return(strlen(buf));
  }
  </code></pre>