title: How to export private key from a keystore of self-signed certificate
body: <p>I just created a self-signed certificate on a linux box running tomcat 6.</p>
  
  <p>I created the keys like this, valid for 10 years:</p>
  
  <pre><code>keytool -genkey -alias tomcatorange -keyalg RSA -validity 3650
  </code></pre>
  
  <p>and copied the keystore into a folder in tomcat, and updated server.xml to point at the keystore.</p>
  
  <p>Now my network admin is asking for the both the public and private key ( for our load balancer)</p>
  
  <p>I can generate the public key using:</p>
  
  <pre><code>openssl s_client -connect mydomain.com:8443
  </code></pre>
  
  <p>But how can I export/retrieve the private key?</p>