title: How to extract public key using OpenSSL?
body: <p>The following command generates a file which contains both public and private key:</p>
  
  <pre><code>openssl genrsa -des3 -out privkey.pem 2048
  </code></pre>
  
  <p>Source: <a href="http://www.openssl.org/docs/HOWTO/keys.txt" rel="noreferrer">here</a></p>
  
  <p><em>With OpenSSL, the private key contains the public key information as well, so a public key doesn't need to be generated separately</em></p>
  
  <p>How can we extract the public key from the privkey.pem file?</p>
  
  <p>Thanks.</p>