title: Export Public Key from an p12-file
body: <p>I have an p12-file exported from the Firefox-Browser. And now I want to extract the public key to give them to friends (not the whole p12-file). </p>
  
  <p>I used OpenSSL-Windows32 and convert the p12 into an pem, after that I tryed to export the public key from the pem.</p>
  
  <p>Thats the syntax I used:</p>
  
  <pre><code>openssl pkcs12 -in pgp.p12 -clcerts -out pgp.pem
  openssl pkey -in pgp.pem -pubout -out pub.pem
  </code></pre>
  
  <p>Now I have the pub.pem with contains something like this: </p>
  
  <pre><code>-----BEGIN PUBLIC KEY-----
  MIIBIjANBgkqhkiG9......
  -----END PUBLIC KEY-----
  </code></pre>
  
  <p>Is that the right way to export the pub-file? And can I give the pgp.pem to my friends without risks?</p>