title: Read certificate files from memory instead of a file using OpenSSL
body: <p>I have a server which would listen on HTTPS using OpenSSL. For this, I have to provide the certificate to use. However, the current implementation uses a filename to be provided to the OpenSSL API.</p>
  
  <p>I want the certificate information to be read from memory, so that I don't have to ship the certificate file opening. I tried to google, but I didn't come up with any options.</p>
  
  <p>Is is possible? If so, how do I read certificate files from memory instead of a file using OpenSSL?</p>
  
  <hr>
  
  <p><strong><em>EDIT</em></strong>: The following was moved from the comments to the question.</p>
  
  <pre><code>// CURRENT
  void start_server()
  {
      const char *fileName = "cert_and_key.pem";
      set_server_ssl_file(fileName);
  }
  set_server_ssl_file(const char *fileName)
  {
      //initialize context
      SSL_CTX_use_certificate_file(CTX, pem, SSL_FILETYPE_PEM); 
      SSL_CTX_use_PrivateKey_file(CTX, pem, SSL_FILETYPE_PEM);
  }
  
  //REQUIRED
  void start_server()
  {
      const char *cert = "--BEGIN CERTIFICATE--............";
      const char *key = "--BEGIN RSA PRIVATE KEY--.......";
      set_server_ssl_options(cert, key);
  }
  set_server_ssl_options(const char *cert, const char *key)
  {
      //IMPLEMENTATION REQUIRED
  }
  </code></pre>