title: Python SSL X509: KEY_VALUES_MISMATCH
body: <pre><code>"""Python HTTPS server"""
  
  from http.server import HTTPServer, SimpleHTTPRequestHandler
  import ssl
  
  # https://stackoverflow.com/a/40822838/2715716
  HTTPD = HTTPServer(('localhost', 4443), SimpleHTTPRequestHandler)
  
  # Ubuntu on Windows:
  # - Generate key:
  # `openssl req -x509 -newkey rsa:2048 -keyout key.pem -out cert.pem -days 365`
  # - Strip passphrase:
  # `openssl rsa -in key.pem -out key-no-pass.pem`
  HTTPD.socket = ssl.wrap_socket(HTTPD.socket,
                                keyfile='key-no-pass.pem', certfile='cert.pem', server_side=True)
  
  HTTPD.serve_forever()
  </code></pre>
  
  <p>The above gives me <em>ssl.SSLError: [X509: KEY_VALUES_MISMATCH] key values mismatch (_ssl.c:2846)</em>. Is there a way to know the mismatched values?</p>
  
  <p>I tried using <code>openssl verify -verbose -CAfile cert.pem</code> in hopes it would tell me which values mismatch, but I don't know to use it and the command I wrote just opens some interactive prompt of sorts.</p>
  
  <p>I don't know anything about certificates or Python, I only ever do <code>python -m SimpleHTTPServer</code>. This is me trying to get a self-signed certificate so Chrome would get off my back about having to use HTTPS for some WebRTC stuff to work on <code>localhost</code>.</p>