title: CouchDB over HTTPS and self-certified certificate : browsers reject it
body: <p>I've been following <a href="https://wiki.apache.org/couchdb/How_to_enable_SSL" rel="nofollow">these instructions</a> to enable ssl on my CouchDB instance running on Windows.
  I am using self-certified .pem certificate and key generated with </p>
  
  <pre><code>openssl req -x509 -newkey rsa:2048 -keyout key.pem -out cert.pem -days 365
  </code></pre>
  
  <p>It works fine using <code>curl -k https://127.0.0.1:6984/</code>, but Chrome and Firefox react differently:</p>
  
  <ul>
  <li>Firefox first makes me add a security exception for the self-signed certificate, then throws a <code>sec_error_invalid_key</code></li>
  <li>Chrome just throws an <code>ERR_SSL_PROTOCOL_ERROR</code>. I tried manually adding my certificate to Chrome, same result.</li>
  </ul>
  
  <p>On rejected connections, the Erlang console shows:</p>
  
  <pre><code>[error] [&lt;0.15176.0&gt;] SSL: certify: tls_connection.erl:2286:Fatal error: decode error
  </code></pre>
  
  <p>I need access from browsers as this is a web app. Is my key and certificate generation correct? </p>