title: Exporting an ECDSA public key to a format recognisable by non-.NET users (e.g. OpenSSL)
body: <p>I've been working on signing and verifying files with ECDSA, and have got all my in-house tests working fine.  However, I can't complete testing with my client, because they cannot import my public key.</p>
  
  <p>I'm using <code>CngKey.Export(CngKeyBlobFormat.EccPublicBlob)</code>, but it appears the format of the resulting <code>byte[]</code> is proprietary (and therefore useless).</p>
  
  <p>How might I export this in a more-common format (such as PEM or DER), that is readable by non-.NET users, without over-reliance on third-partly libraries (e.g. I don't want to have to rewrite everything to use BouncyCastle)?</p>
  
  <p>For example, how do I get from:</p>
  
  <pre><code>const string keyName = "My Key";
  
  var provider = CngProvider.MicrosoftSoftwareKeyStorageProvider;
  var cngOptions = CngKeyOpenOptions.UserKey;
  
  if (CngKey.Exists(keyName, provider, cngOptions))
  {
      using (var key = CngKey.Open(keyName, provider, cngOptions))
      {
          byte[] keyData = key.Export(CngKeyBlobFormat.EccPublicBlob);            
      }
  }
  </code></pre>
  
  <p>...to:</p>
  
  <pre><code>-----BEGIN PUBLIC KEY-----
  MHYwEAYHKoZIzj0CAQYFK4EEACIDYgAElkRqN7wIGwvHP0HCMuBZPS/L5ZDp4mBG
  A5qssu1FumNtCEHQbjbUa46AvpXRL290Mr2iabTv9Z/SwDciihKZI6BrzSb1x060
  WDgXslbTnzzh+lxne2AZtPPPzorZOiI7
  -----END PUBLIC KEY-----
  </code></pre>
  
  <p>...?</p>