title: exporting a public key in pem format from x509certificate2 object
body: <p>I'm new to this subject, and I got confused of the differences between a public key in PEM format vs CER format.</p>
  
  <p>I'm trying to export a public key from a x509certificate2 object in PEM format in c# code.</p>
  
  <p>As far as I understand, the difference between a certificate in cer format vs pem format, is only the header and footer
  (if I understand correctly, a certificate in .cer format in base 64 should be someBase64String and in pem format it's the same string including the begin and end header and footer).</p>
  
  <p>but my question is for the public key.
  let pubKey be a public key exported in .cer format from an x509certificate2 object,
  is the pem format of this key, will be:</p>
  
  <pre><code>------BEGIN PUBLIC KEY-----
  pubKey...
  ------END PUBLIC KEY------
  </code></pre>
  
  <p>encoded in base 64?</p>
  
  <p>Thanks :)</p>