title: How to use .jks (Java keystore) file to make an HTTP request in Python
body: <p>I have been shared with a <code>.jks</code> file and a <code>private key</code>, and I need to make an HTTP post request using <code>requests</code> module.</p>
  
  <p>I went through the <a href="http://docs.python-requests.org/en/master/user/advanced/#ssl-cert-verification" rel="nofollow noreferrer">requests</a> module and found that I can make the request something like this -</p>
  
  <pre><code>requests.post(&lt;url&gt;, &lt;req xml&gt;, headers={k: v}, cert=('/path/client.cert', '/path/client.key'))
  </code></pre>
  
  <p>But my file has <code>.jks</code> extension. I tried running the request like below -</p>
  
  <pre><code>requests.post(&lt;url&gt;, &lt;req xml&gt;, headers={k: v}, cert=('/path/file.jks', 'my-private-key'))
  </code></pre>
  
  <p>I get this error - </p>
  
  <blockquote>
    <p>OpenSSL.SSL.Error: [('PEM routines', 'PEM_read_bio', 'no start line'),
    ('SSL rou tines', 'SSL_CTX_use_certificate_file', 'PEM lib')]</p>
  </blockquote>
  
  <p>Is it possible to use <code>.jks</code> file to make an HTTP request? Any suggestion how can I correct this. Thanks.</p>